示例#1
0
 def test_matches_log_patterns_str(self, log_mock):
     """ParserBase - Matches Log Patterns, Str"""
     record = {'key': 'matching pattern'}
     patterns = {'key': '*pattern'}
     assert_equal(ParserBase._matches_log_patterns(record, patterns), True)
     log_mock.assert_any_call('Transforming flat pattern \'%s\' into list',
                              '*pattern')
示例#2
0
 def test_matches_log_patterns_invalid_key(self, log_mock):
     """ParserBase - Matches Log Patterns, Invalid Key"""
     record = {'key': 'value'}
     patterns = {'not_key': '*pattern'}
     assert_equal(ParserBase._matches_log_patterns(record, patterns), False)
     log_mock.assert_any_call(
         'Declared log pattern key [%s] does exist in record:\n%s',
         'not_key', record)
示例#3
0
 def test_matches_log_patterns_nested(self):
     """ParserBase - Matches Log Patterns, Nested"""
     record = {'key': {'value': {'nest': 'testing pattern'}}}
     patterns = {'key': {'value': {'nest': ['*pattern']}}}
     assert_equal(ParserBase._matches_log_patterns(record, patterns), True)
示例#4
0
 def test_matches_log_patterns_none(self):
     """ParserBase - Matches Log Patterns, None"""
     record = {'key': 'value'}
     assert_equal(ParserBase._matches_log_patterns(record, {}), True)
示例#5
0
 def test_matches_log_patterns_list(self):
     """ParserBase - Matches Log Patterns, List"""
     record = {'key': 'matching pattern'}
     patterns = {'key': ['*pattern']}
     assert_equal(ParserBase._matches_log_patterns(record, patterns), True)