summaryrefslogtreecommitdiff
path: root/tests/core/logs.py
blob: 69a4775a905e424cf2ccc3c7e848c7003cbe0a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-


# Tests validant le bon calcul d'empreintes.


from chrysacase import ChrysalideTestCase
from pychrysalide import core


class TestCoreLogs(ChrysalideTestCase):
    """TestCase for analysis.core.core."""

    def testDefaultLevel(self):
        """Ensure all messages are hidden by default."""

        self.assertEqual(core.get_verbosity(), core.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'):

            core.set_verbosity('XXX')


    def testWrongMessage(self):
        """Check for unhandled message level."""

        with self.assertRaisesRegex(Exception, 'Invalid type of message'):

            core.log_message(core.LMT_COUNT, 'Message')