def test_no_create_recordset_via_alt_domain(self): zone = self.useFixture(ZoneFixture(user='******')).created_zone alt_zone = self.useFixture(ZoneFixture(user='******')).created_zone # alt attempts to create record with name A12345.{zone} recordset = datagen.random_a_recordset(zone_name=zone.name) self.assertRaises(exceptions.RestClientException, lambda: RecordsetClient.as_user('alt') .post_recordset(zone.id, recordset)) self.assertRaises(exceptions.RestClientException, lambda: RecordsetClient.as_user('alt') .post_recordset(alt_zone.id, recordset))
def test_no_create_duplicate_domain(self): post_model = self.useFixture(ZoneFixture(user='******')).post_model self.assertRaises( Conflict, lambda: ZoneClient.as_user('default').post_zone(post_model)) self.assertRaises( Conflict, lambda: ZoneClient.as_user('alt').post_zone(post_model))
def test_export_domain(self): user = '******' zone_fixture = self.useFixture(ZoneFixture(user=user)) zone = zone_fixture.created_zone export_fixture = self.useFixture(ZoneExportFixture(zone.id, user=user)) export_id = export_fixture.zone_export.id export_client = ZoneExportClient.as_user(user) resp, model = export_client.get_zone_export(export_id) self.assertEqual(200, resp.status) self.assertEqual('COMPLETE', model.status) # fetch the zone file resp, zone_file = export_client.get_exported_zone(export_id) self.assertEqual(200, resp.status) self.assertEqual(zone.name, zone_file.origin) self.assertEqual(zone.ttl, zone_file.ttl) # the list of records in the zone file must match the zone's recordsets # (in this case there should be only two records - a SOA and an NS?) recordset_client = RecordsetClient.as_user(user) resp, model = recordset_client.list_recordsets(zone.id) records = [] for recordset in model.recordsets: records.extend(ZoneFileRecord.records_from_recordset(recordset)) self.assertEqual(set(records), set(zone_file.records)) export_client.delete_zone_export(export_id) self.assertRaises(NotFound, lambda: export_client.get_zone_export(export_id))
def test_no_create_subdomain_by_alt_user(self): zone = self.useFixture(ZoneFixture(user='******')).post_model subzone = datagen.random_zone_data(name='sub.' + zone.name) subsubzone = datagen.random_zone_data(name='sub.sub.' + zone.name) self.assertRaises(Forbidden, lambda: ZoneClient.as_user('alt').post_zone(subzone)) self.assertRaises( Forbidden, lambda: ZoneClient.as_user('alt').post_zone(subsubzone))
def test_no_create_super_recordsets(self): # default creates zone a.b.c.example.com. # alt fails to create record with name b.c.example.com zone_data = datagen.random_zone_data() recordset = datagen.random_a_recordset(zone_name=zone_data.name) recordset.name = 'b.c.' + zone_data.name zone_data.name = 'a.b.c.' + zone_data.name fixture = self.useFixture(ZoneFixture(zone_data, user='******')) self.assertRaises(exceptions.RestClientException, lambda: RecordsetClient.as_user('alt') .post_recordset(fixture.created_zone.id, recordset))
def test_no_create_recordset_by_alt_tenant(self): zone = self.useFixture(ZoneFixture(user='******')).created_zone # try with name=A123456.zone.com. recordset = datagen.random_a_recordset(zone_name=zone.name) self.assertRaises(exceptions.RestClientException, lambda: RecordsetClient.as_user('alt') .post_recordset(zone.id, recordset)) # try with name=zone.com. recordset.name = zone.name self.assertRaises(exceptions.RestClientException, lambda: RecordsetClient.as_user('alt') .post_recordset(zone.id, recordset))
def setUp(self): super(TransferZoneOwnerShipTest, self).setUp() self.increase_quotas(user='******') self.increase_quotas(user='******') self.ensure_tld_exists('com') self.zone = self.useFixture(ZoneFixture()).created_zone
def test_no_create_superdomain_by_alt_user(self): superzone = datagen.random_zone_data() zone = datagen.random_zone_data(name="a.b." + superzone.name) self.useFixture(ZoneFixture(zone, user='******')) self.assertRaises( Forbidden, lambda: ZoneClient.as_user('alt').post_zone(superzone))
def setUp(self): super(ZoneTest, self).setUp() self.increase_quotas(user='******') self.ensure_tld_exists('com') self.fixture = self.useFixture(ZoneFixture(user='******'))
def setUp(self): super(ZoneTest, self).setUp() self.increase_quotas(user='******') self.client = ZoneClient.as_user('default', with_token=False) self.fixture = self.useFixture(ZoneFixture(user='******'))
def setUp(self): super(RecordsetValidationTest, self).setUp() self.increase_quotas(user='******') self.ensure_tld_exists('com') self.zone = self.useFixture(ZoneFixture()).created_zone self.client = RecordsetClient.as_user('default')
def setUp(self): super(RecordsetTest, self).setUp() self.increase_quotas(user='******') self.ensure_tld_exists('com') self.zone = self.useFixture(ZoneFixture()).created_zone
def setUp(self): super(ZoneTest, self).setUp() self.increase_quotas(user='******') self.fixture = self.useFixture(ZoneFixture(user='******'))