예제 #1
0
    def test_update_blacklist(self):
        old_model = self.useFixture(BlacklistFixture()).created_blacklist

        patch_model = datagen.random_blacklist_data()
        resp, new_model = BlacklistClient.as_user('admin').patch_blacklist(
            old_model.id, patch_model)
        self.assertEqual(resp.status, 200)

        resp, model = BlacklistClient.as_user('admin').get_blacklist(
            new_model.id)
        self.assertEqual(resp.status, 200)
        self.assertEqual(new_model.id, old_model.id)
        self.assertEqual(new_model.pattern, model.pattern)
예제 #2
0
 def test_delete_blacklist(self):
     fixture = self.useFixture(BlacklistFixture())
     resp, model = BlacklistClient.as_user('admin').delete_blacklist(
         fixture.created_blacklist.id)
     self.assertEqual(resp.status, 204)
예제 #3
0
 def test_list_blacklists(self):
     self.useFixture(BlacklistFixture())
     resp, model = BlacklistClient.as_user('admin').list_blacklists()
     self.assertEqual(resp.status, 200)
     self.assertGreater(len(model.blacklists), 0)
예제 #4
0
 def test_create_blacklist(self):
     fixture = self.useFixture(BlacklistFixture())
     self.assertEqual(fixture.post_model.pattern,
                      fixture.created_blacklist.pattern)
예제 #5
0
 def setUp(self):
     super(BlacklistTest, self).setUp()
     self.increase_quotas(user='******')
     self.client = BlacklistClient.as_user('admin', with_token=False)
     self.fixture = self.useFixture(BlacklistFixture(user='******'))