コード例 #1
0
ファイル: test_main.py プロジェクト: stxnext/webhook-repeater
 def test_missing_options(self):
     section = list(self.sections['hook:name2'])
     for i in range(len(self.sections['hook:name2'])):
         self.sections['hook:name2'].pop(i)
         with self.assertRaises(ConfigError):
             parse_hooks(self.config_parser)
         self.sections['hook:name2'] = list(section)
コード例 #2
0
ファイル: test_main.py プロジェクト: stxnext/webhook-repeater
    def test_parsed_hooks(self):
        hooks = parse_hooks(self.config_parser)
        assert 'name1' in hooks
        assert 'name2' in hooks
        assert len(hooks) == 2
        assert hooks['name1']['src_path'] == '/src_path1'
        assert hooks['name1']['src_host'] == 'src_host1'
        assert hooks['name1']['dst_path'] == 'dst_path1'
        assert hooks['name1']['dst_host'] == 'dst_host1'
        assert hooks['name2']['src_path'] == '/src_path2'
        assert hooks['name2']['src_host'] == 'src_host2'
        assert hooks['name2']['dst_path'] == 'dst_path2'
        assert hooks['name2']['dst_host'] == 'dst_host2'

        assert self.config_parser.sections.call_count == 1
        assert self.config_parser.items.call_count == 2
        args = [args[1][0] for args in self.config_parser.items.mock_calls]
        assert 'hook:name1' in args
        assert 'hook:name2' in args
コード例 #3
0
ファイル: test_main.py プロジェクト: stxnext/webhook-repeater
 def test_duplicated_source_paths(self):
     self.sections['hook:name2'][1] = ('src_path', '/src_path1')
     with self.assertRaises(ConfigError):
         parse_hooks(self.config_parser)
コード例 #4
0
ファイル: test_main.py プロジェクト: stxnext/webhook-repeater
 def test_no_hooks(self):
     self.config_parser.sections.side_effect = ['section']
     with self.assertRaises(ConfigError):
         parse_hooks(self.config_parser)