pvl/hosts/tests.py
changeset 441 f058fff1f272
parent 440 1d755df7bf97
child 447 6f0357759e9b
--- a/pvl/hosts/tests.py	Tue Feb 24 17:35:36 2015 +0200
+++ b/pvl/hosts/tests.py	Tue Feb 24 17:45:45 2015 +0200
@@ -18,6 +18,19 @@
     def setUp(self):
         self.options = Options()
 
+    def testApply(self):
+        expected = [
+            ('foo', 'test', ipaddr.IPAddress('127.0.0.1')),
+            ('bar', 'test', ipaddr.IPAddress('127.0.0.2')),
+        ]
+
+        for expect, host in zip(expected, config.apply(self.options, ['etc/hosts/test'])):
+            hostname, domain, ip = expect
+
+            self.assertEquals(str(host), hostname)
+            self.assertEquals(host.domain, domain)
+            self.assertEquals(host.ip, ip)
+ 
     def testApplyHostsError(self):
         with self.assertRaises(config.HostConfigError):
             list(config.apply_hosts(self.options, ['nonexistant']))