def test_get_missing_ns_record(self): """Retrieve a missing NS record; return an empty list.""" type = 'NS' ns = SpokeDNSNS(self.org_name, self.dns_zone_name) result = ns.get(type)['data'] expected_result = [] self.assertEqual(result, expected_result)
def test_get_ns_records(self): """Retrieve all NS records; return NS record objects.""" type = 'NS' ns0 = 'ns0.aethernet.local' ns1 = 'ns1.aethernet.local' ns = SpokeDNSNS(self.org_name, self.dns_zone_name) ns.create(type, ns0) ns.create(type, ns1) result = ns.get(type)['data'] dn = '%s=%s,%s' % (self.dns_zone_name_attr, self.dns_zone_name, self.dns_base) dn_info = {'objectClass': ['top', self.dns_zone_name_class], 'relativeDomainName': ['@'], 'zoneName': [self.dns_zone_name], self.dns_ns_attr: [ns0 + '.', ns1 + '.']} expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result)
def test_delete_specific_ns_record(self): """Delete specific NS record; return remaining NS record object.""" type = 'NS' ns0 = 'ns0.aethernet.local' ns1 = 'ns1.aethernet.local' ns = SpokeDNSNS(self.org_name, self.dns_zone_name) ns.create(type, ns0) ns.create(type, ns1) ns.delete(type, ns0) result = ns.get(type)['data'] dn = '%s=%s,%s' % (self.dns_zone_name_attr, self.dns_zone_name, self.dns_base) dn_info = {'objectClass': ['top', self.dns_zone_name_class], 'relativeDomainName': ['@'], 'zoneName': [self.dns_zone_name], self.dns_ns_attr: [ns1 +'.']} expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result)
def test_get_ns_records(self): """Retrieve all NS records; return NS record objects.""" type = 'NS' ns0 = 'ns0.aethernet.local' ns1 = 'ns1.aethernet.local' ns = SpokeDNSNS(self.org_name, self.dns_zone_name) ns.create(type, ns0) ns.create(type, ns1) result = ns.get(type)['data'] dn = '%s=%s,%s' % (self.dns_zone_name_attr, self.dns_zone_name, self.dns_base) dn_info = { 'objectClass': ['top', self.dns_zone_name_class], 'relativeDomainName': ['@'], 'zoneName': [self.dns_zone_name], self.dns_ns_attr: [ns0 + '.', ns1 + '.'] } expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result)
def test_delete_specific_ns_record(self): """Delete specific NS record; return remaining NS record object.""" type = 'NS' ns0 = 'ns0.aethernet.local' ns1 = 'ns1.aethernet.local' ns = SpokeDNSNS(self.org_name, self.dns_zone_name) ns.create(type, ns0) ns.create(type, ns1) ns.delete(type, ns0) result = ns.get(type)['data'] dn = '%s=%s,%s' % (self.dns_zone_name_attr, self.dns_zone_name, self.dns_base) dn_info = { 'objectClass': ['top', self.dns_zone_name_class], 'relativeDomainName': ['@'], 'zoneName': [self.dns_zone_name], self.dns_ns_attr: [ns1 + '.'] } expected_result = [(dn, dn_info)] self.assertEqual(result, expected_result)