pvl/hosts/tests.py
changeset 713 d5e2d1d9716a
parent 700 88b0d3df1ad7
child 733 45bedeba92e5
--- a/pvl/hosts/tests.py	Tue Mar 03 11:41:32 2015 +0200
+++ b/pvl/hosts/tests.py	Tue Mar 03 11:58:10 2015 +0200
@@ -18,6 +18,7 @@
                 hosts_charset   = 'utf-8',
                 hosts_domain    = None,
                 hosts_include   = None,
+                hosts_include_trace = None,
         )
 
     def assertHostEqual(self, host, host_str, attrs):
@@ -185,7 +186,13 @@
 
     def testApplyIncludePath(self):
         self.options.hosts_include = 'etc/hosts'
-        self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/zones/forward/test']), [
+        include_trace = [ ]
+
+        hosts = list(config.apply_hosts_files(self.options, ['etc/zones/forward/test'],
+            include_trace   = include_trace,
+        ))
+
+        self.assertHostsEqual(hosts, [
                 ('quux@asdf.test', dict(
                     ip          = ipaddr.IPAddress('192.0.2.5'),
                 )),
@@ -197,6 +204,15 @@
                 )),
         ])
 
+        self.assertEqual(include_trace, [
+            'etc/zones/forward/test',
+            'etc/zones/forward/test/asdf.test',
+            'etc/zones/forward/test/test',
+            'etc/hosts/test.d/',
+            'etc/hosts/test.d/bar',
+            'etc/hosts/test.d/foo',
+        ])
+
     def testApply(self):
         self.assertHostsEqual(config.apply(self.options, ['etc/hosts/example.com']), [
                 ('foo@example.com', dict(