pvl/hosts/tests.py
changeset 477 6ad810c8039c
parent 474 51983fcda6b1
child 479 1e68e3a30b51
--- a/pvl/hosts/tests.py	Thu Feb 26 14:31:16 2015 +0200
+++ b/pvl/hosts/tests.py	Thu Feb 26 14:39:42 2015 +0200
@@ -1,7 +1,9 @@
 import ipaddr
+import pvl.args
 import unittest
 
-from pvl.hosts import config, host, zone
+from pvl.hosts import config, dhcp, zone
+from pvl.hosts.host import Host
 from StringIO import StringIO
 
 class Options(object):
@@ -120,12 +122,12 @@
             zone.resolve('origin', None, 'host.domain')
 
     def testHostOutOfOrigin(self):
-        h = host.Host('host', 'domain', ip=ipaddr.IPAddress('10.0.0.1'))
+        h = Host('host', 'domain', ip=ipaddr.IPAddress('10.0.0.1'))
 
         self.assertZoneEquals(zone.host_forward(h, 'test'), { })
 
     def testHostIP(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip  = '192.0.2.1',
                 ip6 = '2001:db8::192.0.2.1',
         )
@@ -136,7 +138,7 @@
         })
     
     def testHostAlias(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip      = '192.0.2.1',
                 alias   = 'test *.test',
         )
@@ -150,7 +152,7 @@
         })
 
     def testHostAlias46(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip      = '192.0.2.1',
                 ip6     = '2001:db8::192.0.2.1',
                 alias4  = 'test4',
@@ -165,7 +167,7 @@
         })
 
     def testHostAlias4Missing(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip6     = '2001:db8::192.0.2.1',
                 alias4  = 'test4',
                 alias6  = 'test6',
@@ -175,7 +177,7 @@
             self.assertZoneEquals(zone.host_forward(h, 'domain'), { })
 
     def testHostAlias6Missing(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip      = '192.0.2.1',
                 alias4  = 'test4',
                 alias6  = 'test6',
@@ -185,7 +187,7 @@
             self.assertZoneEquals(zone.host_forward(h, 'domain'), { })
 
     def testHostDelegate(self):
-        h = host.Host.build('host', 'example.com',
+        h = Host.build('host', 'example.com',
                 forward = 'host.example.net',
         )
 
@@ -194,7 +196,7 @@
         })
 
     def testHostForwardAlias(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 forward = 'host.example.net',
                 alias   = 'test',
         )
@@ -205,7 +207,7 @@
         })
 
     def testHostLocation(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip          = '192.0.2.1',
                 location    = 'test',
         )
@@ -218,7 +220,7 @@
         })
 
     def testHostLocationDomain(self):
-        h = host.Host.build('host', 'foo.domain',
+        h = Host.build('host', 'foo.domain',
                 ip          = '192.0.2.1',
                 location    = 'test@bar.domain',
         )
@@ -231,7 +233,7 @@
         })
 
     def testHostLocationDomainOutOfOrigin(self):
-        h = host.Host.build('host', 'foo.domain',
+        h = Host.build('host', 'foo.domain',
                 ip          = '192.0.2.1',
                 location    = 'test@bar.domain',
         )
@@ -250,12 +252,12 @@
 
     def testHostsForward(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip      = '192.0.2.1',
                     ip6     = '2001:db8::192.0.2.1',
                     alias   = 'test',
                 ),
-                host.Host.build('bar', 'domain',
+                Host.build('bar', 'domain',
                     ip      = '192.0.2.2',
                 )
         ]
@@ -269,10 +271,10 @@
 
     def testHostsConflict(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip      = '192.0.2.1',
                 ),
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip      = '192.0.2.2',
                 )
         ]
@@ -282,10 +284,10 @@
 
     def testHostsAliasConflict(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip          = '192.0.2.1',
                 ),
-                host.Host.build('bar', 'domain',
+                Host.build('bar', 'domain',
                     ip          = '192.0.2.2',
                     alias       = 'foo',
                 )
@@ -301,10 +303,10 @@
 
     def testHostsAlias4Conflict(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip          = '192.0.2.1',
                 ),
-                host.Host.build('bar', 'domain',
+                Host.build('bar', 'domain',
                     ip          = '192.0.2.2',
                     alias4      = 'foo',
                 )
@@ -320,7 +322,7 @@
         self.options.unknown_host = False
 
     def testHostIP(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip  = '192.0.2.1',
                 ip6 = '2001:db8::192.0.2.1',
         )
@@ -334,7 +336,7 @@
         })
 
     def testHostIP4(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip  = '192.0.2.1',
         )
 
@@ -355,7 +357,7 @@
         })
 
     def testHostIP6(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip6 = '2001:db8::192.0.2.1',
         )
 
@@ -367,7 +369,7 @@
         })
 
     def testHostIPOutOfPrefix(self):
-        h = host.Host.build('host', 'domain',
+        h = Host.build('host', 'domain',
                 ip  = '192.0.2.1',
                 ip6 = '2001:db8::192.0.2.1',
         )
@@ -381,7 +383,7 @@
         })
 
     def testHostDelegate(self):
-        h = host.Host.build('host', 'example.com',
+        h = Host.build('host', 'example.com',
                 ip      = '192.0.2.1',
                 ip6     = '2001:db8::192.0.2.1',
                 forward = '',
@@ -402,10 +404,10 @@
 
     def testHostsConflict(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip      = '192.0.2.1',
                 ),
-                host.Host.build('bar', 'domain',
+                Host.build('bar', 'domain',
                     ip      = '192.0.2.1',
                 )
         ]
@@ -415,10 +417,10 @@
 
     def testHostsGenerateUnknown(self):
         hosts = [
-                host.Host.build('foo', 'domain',
+                Host.build('foo', 'domain',
                     ip      = '192.0.2.1',
                 ),
-                host.Host.build('bar', 'domain',
+                Host.build('bar', 'domain',
                     ip      = '192.0.2.5',
                 ),
         ]