pvl/hosts/tests.py
changeset 663 8a9de457bb59
parent 661 15946375b154
child 669 83e9bff09a0b
equal deleted inserted replaced
662:4750b8b85aa1 663:8a9de457bb59
   136                 ('bar@quux.test', dict(ip=ipaddr.IPAddress('127.0.0.2'))),
   136                 ('bar@quux.test', dict(ip=ipaddr.IPAddress('127.0.0.2'))),
   137         ])
   137         ])
   138 
   138 
   139     def testApplyIncludes(self):
   139     def testApplyIncludes(self):
   140         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/hosts/test']), [
   140         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/hosts/test']), [
       
   141                 ('bar@test', dict(
       
   142                     ip          = ipaddr.IPAddress('192.0.2.2'),
       
   143                 )),
   141                 ('foo@test', dict(
   144                 ('foo@test', dict(
   142                     ip          = ipaddr.IPAddress('192.0.2.1'),
   145                     ip          = ipaddr.IPAddress('192.0.2.1'),
       
   146                 )),
       
   147         ])
       
   148 
       
   149     def testApplyIncludePath(self):
       
   150         self.options.hosts_include = 'etc/hosts'
       
   151         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/zones/forward/test']), [
       
   152                 ('quux@asdf.test', dict(
       
   153                     ip          = ipaddr.IPAddress('192.0.2.5'),
   143                 )),
   154                 )),
   144                 ('bar@test', dict(
   155                 ('bar@test', dict(
   145                     ip          = ipaddr.IPAddress('192.0.2.2'),
   156                     ip          = ipaddr.IPAddress('192.0.2.2'),
   146                 )),
   157                 )),
   147         ])
       
   148 
       
   149     def testApplyIncludePath(self):
       
   150         self.options.hosts_include = 'etc/hosts'
       
   151         self.assertHostsEqual(config.apply_hosts_files(self.options, ['etc/zones/forward/test']), [
       
   152                 ('foo@test', dict(
   158                 ('foo@test', dict(
   153                     ip          = ipaddr.IPAddress('192.0.2.1'),
   159                     ip          = ipaddr.IPAddress('192.0.2.1'),
   154                 )),
       
   155                 ('bar@test', dict(
       
   156                     ip          = ipaddr.IPAddress('192.0.2.2'),
       
   157                 )),
       
   158                 ('quux@asdf.test', dict(
       
   159                     ip          = ipaddr.IPAddress('192.0.2.5'),
       
   160                 )),
   160                 )),
   161         ])
   161         ])
   162 
   162 
   163     def testApply(self):
   163     def testApply(self):
   164         self.assertHostsEqual(config.apply(self.options, ['etc/hosts/example.com']), [
   164         self.assertHostsEqual(config.apply(self.options, ['etc/hosts/example.com']), [