def test_list_recordsets(self): post_model = datagen.random_a_recordset(self.zone.name) self.useFixture(RecordsetFixture(self.zone.id, post_model)) resp, model = RecordsetClient.as_user('default') \ .list_recordsets(self.zone.id) self.assertEqual(200, resp.status) self.assertGreater(len(model.recordsets), 0)
def test_crud_recordset(self, make_recordset): post_model = make_recordset(self.zone) fixture = self.useFixture(RecordsetFixture(self.zone.id, post_model)) recordset_id = fixture.created_recordset.id self.assert_dns(fixture.post_model) put_model = make_recordset(self.zone) del put_model.name # don't try to update the name resp, put_resp_model = RecordsetClient.as_user('default') \ .put_recordset(self.zone.id, recordset_id, put_model) self.assertEqual(202, resp.status, "on put response") self.assertEqual("PENDING", put_resp_model.status) self.assertEqual(post_model.name, put_resp_model.name) self.assertEqual(put_model.records, put_resp_model.records) self.assertEqual(put_model.ttl, put_resp_model.ttl) RecordsetClient.as_user('default').wait_for_recordset( self.zone.id, recordset_id) put_model.name = post_model.name self.assert_dns(put_model) resp, delete_resp_model = RecordsetClient.as_user('default') \ .delete_recordset(self.zone.id, recordset_id) self.assertEqual(202, resp.status, "on delete response") RecordsetClient.as_user('default').wait_for_404( self.zone.id, recordset_id)
def test_update_invalid(self, make_recordset, data=None): data = data or ["b0rk"] post_model = make_recordset(self.zone) fixture = self.useFixture(RecordsetFixture(self.zone.id, post_model)) recordset_id = fixture.created_recordset.id for i in data: model = make_recordset(self.zone) model.data = i self._assert_exception(exceptions.BadRequest, 'invalid_object', 400, self.client.put_recordset, self.zone.id, recordset_id, model)
def test_can_create_and_query_wildcard_recordset(self, make_recordset): post_model = make_recordset(self.zone) self.useFixture(RecordsetFixture(self.zone.id, post_model)) verify_models = [ post_model.from_dict(post_model.to_dict()) for x in range(3) ] verify_models[0].name = "abc.{0}".format(self.zone.name) verify_models[1].name = "abc.def.{0}".format(self.zone.name) verify_models[2].name = "abc.def.hij.{0}".format(self.zone.name) for m in verify_models: self.assert_dns(m)
def test_create_SPF_with(self, data): post_model = datagen.random_spf_recordset(self.zone.name, data) fixture = self.useFixture(RecordsetFixture(self.zone.id, post_model)) recordset = fixture.created_recordset self.client.wait_for_recordset(self.zone.id, recordset.id)