pvl.hosts.zone: test forward hosts
authorTero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 16:01:10 +0200
changeset 494 6d258338b363
parent 493 c9725dd0d48c
child 495 629fc999cc33
pvl.hosts.zone: test forward hosts
pvl/hosts/tests.py
--- a/pvl/hosts/tests.py	Thu Feb 26 15:57:52 2015 +0200
+++ b/pvl/hosts/tests.py	Thu Feb 26 16:01:10 2015 +0200
@@ -401,6 +401,27 @@
 
         })
 
+    def testHosts(self):
+        hosts = [
+                Host.build('foo', 'domain',
+                    ip      = '192.0.2.1',
+                ),
+                Host.build('bar', 'domain',
+                    ip      = '192.0.2.2',
+                )
+        ]
+        
+        self.assertZoneEquals(zone.apply_hosts_reverse(hosts, ipaddr.IPNetwork('192.0.2.1/24')), {
+            ('1', 'PTR'): ['foo.domain.'],
+            ('2', 'PTR'): ['bar.domain.'],
+        })
+        
+        # in ip order
+        self.assertZoneEquals(zone.apply_hosts_reverse(reversed(hosts), ipaddr.IPNetwork('192.0.2.1/24')), {
+            ('1', 'PTR'): ['foo.domain.'],
+            ('2', 'PTR'): ['bar.domain.'],
+        })
+
     def testHostsConflict(self):
         hosts = [
                 Host.build('foo', 'domain',