Completed
Push — master ( ba98c2...ab79be )
by P.R.
01:26
created

test.Application.StratumApplicationNoneTest.StratumApplicationNoneTest.test_command_wrapper()   A

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nop 1
dl 15
loc 15
rs 9.9
c 0
b 0
f 0
1
from unittest import TestCase
2
3
from cleo import CommandTester
4
5
from pystratum_cli import StratumApplication
6
7
8
class StratumApplicationNoneTest(TestCase):
9
    """
10
    Test with the none backend.
11
    """
12
13
    # ------------------------------------------------------------------------------------------------------------------
14
    def test_command_stratum(self) -> None:
15
        """
16
        Test stratum command with none backend.
17
        """
18
        application = StratumApplication()
19
20
        command = application.find('stratum')
21
        command_tester = CommandTester(command)
22
        status = command_tester.execute([('command', command.get_name()),
23
                                         ('config_file', 'test/etc/none.cfg')])
24
        output = command_tester.get_display()
25
26
        self.assertEqual(0, status)
27
        self.assertEqual('', output)
28
29
    # ------------------------------------------------------------------------------------------------------------------
30
    def test_command_constants(self) -> None:
31
        """
32
        Test constants command with none backend.
33
        """
34
        application = StratumApplication()
35
36
        command = application.find('constant')
37
        command_tester = CommandTester(command)
38
        status = command_tester.execute([('command', command.get_name()),
39
                                         ('config_file', 'test/etc/none.cfg')])
40
        output = command_tester.get_display()
41
42
        self.assertEqual(-1, status)
43
        self.assertIn('Constants', output)
44
        self.assertIn('ERROR', output)
45
46
    # ------------------------------------------------------------------------------------------------------------------
47
    def test_command_loader(self) -> None:
48
        """
49
        Test constants command with none backend.
50
        """
51
        application = StratumApplication()
52
53
        command = application.find('loader')
54
        command_tester = CommandTester(command)
55
        status = command_tester.execute([('command', command.get_name()),
56
                                         ('config_file', 'test/etc/none.cfg')])
57
        output = command_tester.get_display()
58
59
        self.assertEqual(-1, status)
60
        self.assertIn('Loader', output)
61
        self.assertIn('ERROR', output)
62
63
    # ------------------------------------------------------------------------------------------------------------------
64
    def test_command_wrapper(self) -> None:
65
        """
66
        Test constants command with none backend.
67
        """
68
        application = StratumApplication()
69
70
        command = application.find('wrapper')
71
        command_tester = CommandTester(command)
72
        status = command_tester.execute([('command', command.get_name()),
73
                                         ('config_file', 'test/etc/none.cfg')])
74
        output = command_tester.get_display()
75
76
        self.assertEqual(-1, status)
77
        self.assertIn('Wrapper', output)
78
        self.assertIn('ERROR', output)
79
80
# ----------------------------------------------------------------------------------------------------------------------
81