diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 00:35:33 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-13 00:35:33 (GMT) |
commit | a6975c1d754a1ba5bfb9e23f0b26692c746e6f9c (patch) | |
tree | 7ec962129ebbce6cd210b449443afc91ced72719 /tests | |
parent | 5adcf950f1f928c7127f2d694b52addf54cc04ca (diff) |
Handled the logs from the GUI, the command line and the Python bindings.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/logs.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/core/logs.py b/tests/core/logs.py new file mode 100644 index 0000000..96be519 --- /dev/null +++ b/tests/core/logs.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3-dbg +# -*- coding: utf-8 -*- + + +# Tests validant le bon calcul d'empreintes. + + +from chrysacase import ChrysalideTestCase +from pychrysalide.core import logs + + +class TestCoreLogs(ChrysalideTestCase): + """TestCase for analysis.core.logs.""" + + def testDefaultLevel(self): + """Ensure all messages are hidden by default.""" + + self.assertEqual(logs.get_verbosity(), logs.LMT_COUNT) + + + def testWrongLevel(self): + """Verify the type of level when defining new verbosity.""" + + with self.assertRaisesRegex(Exception, 'argument 1 must be int, not str'): + + logs.set_verbosity('XXX') + + + def testWrongMessage(self): + """Check for unhandled message level.""" + + with self.assertRaisesRegex(Exception, 'Invalid type of message'): + + logs.log_message(logs.LMT_COUNT, 'Message') |