pvl/hosts/tests.py
changeset 471 e4b4458d8061
parent 470 ac334a55eebc
child 472 814cc88c531b
equal deleted inserted replaced
470:ac334a55eebc 471:e4b4458d8061
   222 
   222 
   223         self.assertZoneEquals(zone.host_forward(h, 'domain'), {
   223         self.assertZoneEquals(zone.host_forward(h, 'domain'), {
   224             ('host', 'A'): ['192.0.2.1'],
   224             ('host', 'A'): ['192.0.2.1'],
   225             ('test', 'CNAME'): ['host'],
   225             ('test', 'CNAME'): ['host'],
   226         })
   226         })
       
   227 
       
   228     def testHostLocationDomain(self):
       
   229         h = host.Host.build('host', 'foo.domain',
       
   230                 ip          = '192.0.2.1',
       
   231                 location    = 'test@bar.domain',
       
   232         )
       
   233 
       
   234         self.assertEquals(h.location, ('test', 'bar.domain'))
       
   235 
       
   236         self.assertZoneEquals(zone.host_forward(h, 'domain'), {
       
   237             ('host.foo', 'A'): ['192.0.2.1'],
       
   238             ('test.bar', 'CNAME'): ['host.foo'],
       
   239         })
       
   240 
       
   241     def testHostLocationDomainOutOfOrigin(self):
       
   242         h = host.Host.build('host', 'foo.domain',
       
   243                 ip          = '192.0.2.1',
       
   244                 location    = 'test@bar.domain',
       
   245         )
       
   246 
       
   247         self.assertEquals(h.location, ('test', 'bar.domain'))
       
   248 
       
   249         with self.assertRaises(zone.HostZoneError):
       
   250             self.assertZoneEquals(zone.host_forward(h, 'foo.domain'), {
       
   251                 ('host', 'A'): ['192.0.2.1'],
       
   252             })
       
   253         
       
   254         # TODO
       
   255         #self.assertZoneEquals(zone.host_forward(h, 'bar.domain'), {
       
   256         #    ('test', 'CNAME'): ['host.foo'],
       
   257         #})
   227  
   258  
   228 class TestReverseZone(TestZoneMixin, unittest.TestCase):
   259 class TestReverseZone(TestZoneMixin, unittest.TestCase):
   229     def setUp(self):
   260     def setUp(self):
   230         self.options = Options()
   261         self.options = Options()
   231         self.options.unknown_host = False
   262         self.options.unknown_host = False