summaryrefslogtreecommitdiff
path: root/tests/core/logs.py
blob: 96be5192d48b4f03b056804f4a43ede82ba72997 (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.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')