def test_search_method(self): """Test search method.""" record = DnsRecord('com', 'example.com', '1.2.3.4') alias = record.add_alias('mainserver.example.com') alias.add_subdomain('dev') result = record.search('dev.mainserver.example.com') self.assertEqual(result.fqdn, 'dev.mainserver.example.com')
def test_add_alias(self): """Test add_alias_method.""" record = DnsRecord('com', 'example.com', '1.2.3.4') alias = record.add_alias('www.example.com') self.assertEqual(str(alias), "www.example IN CNAME example") megaserver_alias = alias.add_alias('megaserver.com') self.assertEqual(str(megaserver_alias), "megaserver IN CNAME www.example")
def test_subdomain_to_alias(self): """Test subdomain to alias.""" record = DnsRecord('com', 'example.com', '1.2.3.4') alias = record.add_alias('mainserver.example.com') subdomain = alias.add_subdomain('dev') self.assertEqual( str(subdomain), "dev.mainserver.example IN " "CNAME mainserver.example")