pvl/hosts/tests.py
changeset 504 ee0a3dcacb95
parent 503 a56456f901e8
child 505 e5a76c404679
--- a/pvl/hosts/tests.py	Thu Feb 26 16:38:31 2015 +0200
+++ b/pvl/hosts/tests.py	Thu Feb 26 17:24:13 2015 +0200
@@ -33,7 +33,7 @@
  
     def testApplyHostsFileError(self):
         with self.assertRaises(config.HostConfigError):
-            list(config.apply_hosts(self.options, ['nonexistant']))
+            list(config.apply_hosts_files(self.options, ['nonexistant']))
 
     def testApplyHosts(self):
         conf_file = ConfFile('test', """
@@ -63,23 +63,23 @@
         ])
     
     def testApplyHostFqdn(self):
-        self.assertHostsEqual(config.apply_host_config(self.options, 'test', 'asdf@foo.test'), [
+        self.assertHostsEqual(config.apply_hosts('test', 'asdf@foo.test', { }), [
                 ('asdf@foo.test', dict()),
         ])
 
-        self.assertHostsEqual(config.apply_host_config(self.options, 'test', 'asdf.test2'), [
+        self.assertHostsEqual(config.apply_hosts('test', 'asdf.test2', { }), [
                 ('asdf.test2@', dict()),
         ])
 
     def testApplyHostExpand(self):
-        self.assertHostsEqual(config.apply_host_config(self.options, 'asdf', 'asdf{1-3}', ip='10.100.100.$'), [
-                ('asdf1@asdf', dict(ip=ipaddr.IPAddress('10.100.100.1'))),
-                ('asdf2@asdf', dict(ip=ipaddr.IPAddress('10.100.100.2'))),
-                ('asdf3@asdf', dict(ip=ipaddr.IPAddress('10.100.100.3'))),
+        self.assertHostsEqual(config.apply_hosts('test', 'asdf{1-3}', { 'ip': '10.100.100.$' }), [
+                ('asdf1@test', dict(ip=ipaddr.IPAddress('10.100.100.1'))),
+                ('asdf2@test', dict(ip=ipaddr.IPAddress('10.100.100.2'))),
+                ('asdf3@test', dict(ip=ipaddr.IPAddress('10.100.100.3'))),
         ])
 
     def testApplyHostConfigDict(self):
-        host = config.apply_host(self.options, 'foo', 'test', {
+        host = config.apply_host('foo', 'test', {
             'ethernet.eth0': '00:11:22:33:44:55',
         })
 
@@ -88,7 +88,7 @@
         ))
 
     def testApplyHostConfigDictMulti(self):
-        host = config.apply_host(self.options, 'foo', 'test', {
+        host = config.apply_host('foo', 'test', {
             'ethernet.eth0': '00:11:22:33:44:55',
             'ethernet.eth1': '00:11:22:33:44:66',
         })
@@ -100,15 +100,15 @@
                 }
         ))
    
-    def testApplyHostsConfigError(self):
-        with self.assertRaises(config.HostConfigError):
-            config.apply_host(self.options, 'foo', 'test', {
+    def testApplyHostsConfigErrorDict(self):
+        with self.assertRaises(ValueError):
+            config.apply_host('test', 'foo', {
                 'ethernet': 'foo',
                 'ethernet.eth0': 'bar',
             })
 
     def testApplyHostConfigExtensions(self):
-        host = config.apply_host(self.options, 'foo', 'test', {
+        host = config.apply_host('foo', 'test', {
             'link:50':          'foo@test',
             'link:uplink.49':   'bar@test',
         })
@@ -139,7 +139,9 @@
 
 class TestForwardZone(TestZoneMixin, unittest.TestCase):
     def testHostOutOfOrigin(self):
-        h = Host('host', 'domain', ip=ipaddr.IPAddress('10.0.0.1'))
+        h = Host.build('host', 'domain', 
+                ip  = '10.0.0.1',
+        )
 
         self.assertZoneEquals(zone.host_forward(h, 'test'), { })