Ejemplo n.º 1
0
 def test_no_vpns(self):
     cp = ConfigParser()
     cp.parse_file('data/configs/no_vpns.conf')
     self.assertEqual(cp.settings['name'], 'No VPNs')
     self.assertIsNone(cp.settings['geoip_data'])
     self.assertEqual(cp.settings['datetime_format'], '%d/%m/%Y %H:%M:%S')
     self.assertEqual(len(cp.vpns), 0)
Ejemplo n.º 2
0
 def test_file_not_exists(self):
     """Test parsing non-existant config file raises and InvalidConfigError.
     """
     cp = ConfigParser()
     with self.assertRaises(InvalidConfigError) as ctx:
         cp.parse_file('this_file_doesnt_exist')
     self.assertEqual('Unable to read config file: this_file_doesnt_exist', str(ctx.exception))
Ejemplo n.º 3
0
 def test_empty_host_port(self):
     cp = ConfigParser()
     with self.assertRaises(InvalidConfigError) as ctx:
         cp.parse_file('data/configs/empty_host_port.conf')
     self.assertEqual('Must specify either socket or host and port', str(ctx.exception))
Ejemplo n.º 4
0
 def test_lowercase_monitor(self):
     cp = ConfigParser()
     with self.assertRaises(InvalidConfigError) as ctx:
         cp.parse_file('data/configs/lowercase_monitor.conf')
     self.assertEqual("'Monitor' section required, but not found in config", str(ctx.exception))