| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 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 |