def test_and(self): inclusion = Inclusion({'MESSAGE': ['include this'], 'SYSLOG_IDENTIFIER': ['from this']}) assert inclusion.matches({'MESSAGE': 'include this', 'SYSLOG_IDENTIFIER': 'from this', 'IGNORE': 'ignore this'}) assert not inclusion.matches({'MESSAGE': 'include this'})
def test_or(self): inclusion = Inclusion({'MESSAGE': ['include this', 'or this']}) assert inclusion.matches({'MESSAGE': 'include this', 'IGNORE': 'ignore this'}) assert not inclusion.matches({'MESSAGE': 'not this', 'IGNORE': 'ignore this'})
def test_priority(self): inclusion = Inclusion({'PRIORITY': 'err'}) priority_type = journal.DEFAULT_CONVERTERS.get('PRIORITY', str) assert inclusion.matches({'PRIORITY': priority_type(3)})