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')
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)
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)
def test_matches_log_patterns_none(self): """ParserBase - Matches Log Patterns, None""" record = {'key': 'value'} assert_equal(ParserBase._matches_log_patterns(record, {}), True)
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)