pvl/hosts/tests.py
changeset 692 34f25380d0e7
parent 689 c258e3ff6d32
child 697 3c3ac207ce3f
--- a/pvl/hosts/tests.py	Mon Mar 02 18:17:47 2015 +0200
+++ b/pvl/hosts/tests.py	Mon Mar 02 18:25:50 2015 +0200
@@ -29,13 +29,14 @@
     def assertHostsEqual(self, hosts, expected):
         hosts = list(hosts)
 
-        for host, expect in zip(hosts, expected):
+        for host, expect in itertools.izip_longest(hosts, expected):
+            self.assertIsNotNone(host, expect)
+            self.assertIsNotNone(expect, host)
+            
             host_str, attrs = expect
 
             self.assertHostEqual(host, host_str, attrs)
 
-        self.assertEqual(len(hosts), len(expected))
- 
     def testApplyHostConfigDict(self):
         host = config.apply_host('foo', 'test', {
             'ethernet.eth0': '00:11:22:33:44:55',
@@ -167,6 +168,21 @@
                 )),
         ])
 
+    def testApplyIncludesDefaults(self):
+        self.assertHostsEqual(config.apply_hosts_config(self.options, ConfFile('test', """
+boot.next-server = boot.lan
+
+include = etc/hosts/test
+        """)), [
+                ('bar@test', dict(
+                    ip          = ipaddr.IPAddress('192.0.2.2'),
+                )),
+                ('foo@test', dict(
+                    ip          = ipaddr.IPAddress('192.0.2.1'),
+                )),
+        ])
+
+
     def testApplyIncludePath(self):
         self.options.hosts_include = 'etc/hosts'
         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/zones/forward/test']), [