pvl.hosts.tests: cleanup use of options
authorTero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 15:42:01 +0200
changeset 490 805645dbb9bb
parent 489 7f1bd12e0d54
child 491 cfcb47a3dc3e
pvl.hosts.tests: cleanup use of options
pvl/hosts/tests.py
--- a/pvl/hosts/tests.py	Thu Feb 26 15:29:03 2015 +0200
+++ b/pvl/hosts/tests.py	Thu Feb 26 15:42:01 2015 +0200
@@ -6,11 +6,6 @@
 from pvl.hosts.host import Host
 from StringIO import StringIO
 
-class Options(object):
-    hosts_charset   = 'utf-8'
-    hosts_domain    = None
-    hosts_include   = None
-
 class ConfFile(StringIO):
     def __init__(self, name, buffer):
         StringIO.__init__(self, buffer)
@@ -18,7 +13,11 @@
 
 class TestConfig(unittest.TestCase):
     def setUp(self):
-        self.options = Options()
+        self.options = pvl.args.options(
+                hosts_charset   = 'utf-8',
+                hosts_domain    = None,
+                hosts_include   = None,
+        )
 
     def assertHostEqual(self, host, host_str, attrs):
         self.assertEquals(str(host), host_str)
@@ -101,10 +100,6 @@
 
 
 class TestForwardZone(TestZoneMixin, unittest.TestCase):
-    def setUp(self):
-        self.options = Options()
-        self.options.add_origin = False
-
     def testHostOutOfOrigin(self):
         h = Host('host', 'domain', ip=ipaddr.IPAddress('10.0.0.1'))
 
@@ -301,10 +296,6 @@
     
 
 class TestReverseZone(TestZoneMixin, unittest.TestCase):
-    def setUp(self):
-        self.options = Options()
-        self.options.unknown_host = False
-
     def testHostIP(self):
         h = Host.build('host', 'domain',
                 ip  = '192.0.2.1',
@@ -422,13 +413,6 @@
         })
 
 class TestDhcp(unittest.TestCase):
-    def setUp(self):
-        self.options = pvl.args.options(
-                hosts_charset   = 'utf-8',
-                hosts_domain    = None,
-                hosts_include   = None,
-        )
-
     def assertBlocksEqual(self, blockdefs, expected):
         for (_block, _items, _opts), (block, items, opts) in zip(blockdefs, expected):
             self.assertEqual(_block, block)