Exemple #1
0
 def test_cdn_central_post_pop_unique_duplicate(self):
     existing = PoP.objects().first()
     if existing is not None:
         existing.delete()
     new_pop = dict()
     new_pop['url'] = '192.168.100.100'
     new_pop['admin_uname'] = 'admin'
     new_pop['admin_password'] = '******'
     new_pop['location'] = 'France'
     # test create
     response = self.test_cdn.post_json('/pop', new_pop)
     assert_equals(response.status_int, 201)
     pop_db = PoP.objects(address='192.168.100.100').first()
     assert_equals(pop_db.location, 'France')
     # test duplicate
     response2 = self.test_cdn.post_json('/pop', new_pop, expect_errors=True)
     assert_equals(response2.status_int, 409)