pvl/hosts/tests.py
changeset 689 c258e3ff6d32
parent 688 dfc5fcb6a06c
child 692 34f25380d0e7
--- a/pvl/hosts/tests.py	Mon Mar 02 13:30:15 2015 +0200
+++ b/pvl/hosts/tests.py	Mon Mar 02 17:58:24 2015 +0200
@@ -137,6 +137,26 @@
                 ('bar@quux.test', dict(ip=ipaddr.IPAddress('127.0.0.2'))),
         ])
 
+    def testHostsConfigDdefaults(self):
+        hosts = config.apply_hosts_config(self.options, ConfFile('test', """
+boot.next-server = boot.lan
+
+[foo]
+    ip = 192.0.2.1
+    ethernet.eth0 = 00:11:22:33:44:55
+    boot.filename = /pxelinux.0
+        """))
+        
+        self.assertHostsEqual(hosts, [
+                ('foo@test', dict(
+                    ip          = ipaddr.IPAddress('192.0.2.1'),
+                    ethernet    = { 'eth0': '00:11:22:33:44:55' },
+                    boot        = { 'next-server': 'boot.lan', 'filename': '/pxelinux.0' },
+                )),
+        ])
+
+
+ 
     def testApplyIncludes(self):
         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/hosts/test']), [
                 ('bar@test', dict(
@@ -664,6 +684,10 @@
                         ethernet    = '00:11:22:33:44:55',
                         boot        = '/debian/wheezy/pxelinux.0',
                 ),
+                Host.build('foo4', 'test',
+                        ethernet    = '00:11:22:33:44:55',
+                        boot        = {'next-server': 'boot.lan', 'filename': '/debian/wheezy/pxelinux.0' },
+                ),
         ]
 
         self.assertBlocksEqual(list(dhcp.dhcp_hosts(hosts)), [
@@ -681,10 +705,16 @@
             (('host', 'foo3'), [
                 ('option', 'host-name', "foo3"),
                 ('hardware', 'ethernet', '00:11:22:33:44:55'),
-                ('filename', 'debian/wheezy/pxelinux.0'),
+                ('filename', '/debian/wheezy/pxelinux.0'),
+            ], []),
+            (('host', 'foo4'), [
+                ('option', 'host-name', "foo4"),
+                ('hardware', 'ethernet', '00:11:22:33:44:55'),
+                ('next-server', 'boot.lan'),
+                ('filename', '/debian/wheezy/pxelinux.0'),
             ], []),
         ])
-
+    
     def testHosts(self):
         hosts = [
                 Host.build('foo', 'test',