pvl/hosts/tests.py
changeset 468 3e7cb8dd5708
parent 467 3bb00e5e79d3
child 469 cd1f1b51f3a0
--- a/pvl/hosts/tests.py	Wed Feb 25 14:59:48 2015 +0200
+++ b/pvl/hosts/tests.py	Wed Feb 25 15:06:28 2015 +0200
@@ -155,6 +155,41 @@
             ('*.test', 'CNAME'): ['host'],
         })
 
+    def testHostAlias46(self):
+        h = host.Host.build('host', 'domain',
+                ip      = '192.0.2.1',
+                ip6     = '2001:db8::192.0.2.1',
+                alias4  = 'test4',
+                alias6  = 'test6',
+        )
+
+        self.assertZoneEquals(zone.host_forward(h, 'domain'), {
+            ('host', 'A'): ['192.0.2.1'],
+            ('host', 'AAAA'): ['2001:db8::c000:201'],
+            ('test4', 'A'): ['192.0.2.1'],
+            ('test6', 'AAAA'): ['2001:db8::c000:201'],
+        })
+
+    def testHostAlias4Missing(self):
+        h = host.Host.build('host', 'domain',
+                ip6     = '2001:db8::192.0.2.1',
+                alias4  = 'test4',
+                alias6  = 'test6',
+        )
+
+        with self.assertRaises(zone.HostZoneError):
+            self.assertZoneEquals(zone.host_forward(h, 'domain'), { })
+
+    def testHostAlias6Missing(self):
+        h = host.Host.build('host', 'domain',
+                ip      = '192.0.2.1',
+                alias4  = 'test4',
+                alias6  = 'test6',
+        )
+
+        with self.assertRaises(zone.HostZoneError):
+            self.assertZoneEquals(zone.host_forward(h, 'domain'), { })
+
     def testHostForwardAlias(self):
         h = host.Host.build('host', 'domain',
                 forward = 'host.example.net',