summaryrefslogtreecommitdiff
path: root/tests/core/logs.py
blob: 656d212d524d60a6e7b0f7df32ff9b7337c532f8 (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

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.LogMessageType.COUNT)


    def testWrongLevel(self):
        """Verify the type of level when defining new verbosity."""

        with self.assertRaisesRegex(Exception, 'unable to convert the provided argument to LogMessageType'):

            core.set_verbosity('XXX')


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

        with self.assertRaisesRegex(Exception, 'invalid value for LogMessageType'):

            core.log_message(core.LogMessageType.COUNT, 'Message')