tests: Add _debug_log test for BaseKeyParser.

This commit is contained in:
Florian Bruhin 2015-08-26 20:38:29 +02:00
parent f78fb0c027
commit 1f26b3090c

View File

@ -41,6 +41,24 @@ def mock_timer(monkeypatch, stubs):
stubs.FakeTimer)
class TestDebugLog:
"""Make sure _debug_log only logs when do_log is set."""
def test_log(self, caplog):
kp = basekeyparser.BaseKeyParser(0)
kp._debug_log('foo')
assert len(caplog.records()) == 1
record = caplog.records()[0]
assert record.message == 'foo'
def test_no_log(self, caplog):
kp = basekeyparser.BaseKeyParser(0)
kp.do_log = False
kp._debug_log('foo')
assert not caplog.records()
class TestSplitCount:
"""Test the _split_count method.