TestMailboxCleanerCLI.test_cli()   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 9
nop 1
dl 0
loc 13
rs 9.95
c 0
b 0
f 0
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
"""Module documentation goes here."""
5
6
7
import unittest
8
import sys
9
from unittest.mock import patch
10
from src import mailbox_cli
11
from tests.test_mailbox_abstract import TestMailboxAbstract
12
13
14
class TestMailboxCleanerCLI(TestMailboxAbstract, unittest.TestCase):
15
    """Class documentation goes here."""
16
17
    def test_cli(self):
18
        """Testing the CLI."""
19
20
        with self.assertRaises(SystemExit) as code:
21
            mailbox_cli.main()
22
23
        self.assertEqual(code.exception.code, 2)
24
25
        testargs = ["prog", "-s unknown.localhost", "-u test", "-p test"]
26
        with patch.object(sys, 'argv', testargs):
27
            with self.assertRaises(SystemExit) as code:
28
                mailbox_cli.main()
29
            self.assertTrue("wrong server?" in code.exception.code)
30
31
32
if __name__ == '__main__':
33
    unittest.main()
34