~rvb/maas/dj-migrations

« back to all changes in this revision

Viewing changes to src/maasserver/api/tests/test_tag.py

  • Committer: Raphael Badin
  • Date: 2015-03-13 15:22:22 UTC
  • mfrom: (3631.1.15 maas)
  • Revision ID: raphael.badin@canonical.com-20150313152222-nhq1vs6hop1ooq7e
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
 
98
98
    def test_PUT_refuses_non_superuser(self):
99
99
        tag = factory.make_Tag()
100
 
        response = self.client_put(
 
100
        response = self.client.put(
101
101
            self.get_tag_uri(tag), {'comment': 'A special comment'})
102
102
        self.assertEqual(httplib.FORBIDDEN, response.status_code)
103
103
 
105
105
        self.become_admin()
106
106
        tag = factory.make_Tag()
107
107
        # Note that 'definition' is not being sent
108
 
        response = self.client_put(
 
108
        response = self.client.put(
109
109
            self.get_tag_uri(tag),
110
110
            {'name': 'new-tag-name', 'comment': 'A random comment'})
111
111
 
122
122
        tag = factory.make_Tag(definition='//node/foo')
123
123
        self.expectThat(populate_tags, MockCalledOnceWith(tag))
124
124
        self.become_admin()
125
 
        response = self.client_put(
 
125
        response = self.client.put(
126
126
            self.get_tag_uri(tag),
127
127
            {'definition': '//node/bar'})
128
128
        self.assertEqual(httplib.OK, response.status_code)
178
178
        tag = factory.make_Tag(definition='//child')
179
179
        node.tags.add(tag)
180
180
        self.assertItemsEqual([tag.name], node.tag_names())
181
 
        response = self.client_put(
 
181
        response = self.client.put(
182
182
            self.get_tag_uri(tag), {'definition': 'invalid::tag'})
183
183
 
184
184
        self.assertEqual(httplib.BAD_REQUEST, response.status_code)