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

test.Application.StratumApplicationVoidTest.StratumApplicationVoidTest.test_command_constants()   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 StratumApplicationVoidTest(TestCase):
9
    """
10
    Test with the void backend.
11
    """
12
13
    # ------------------------------------------------------------------------------------------------------------------
14
    def test_command_stratum(self) -> None:
15
        """
16
        Test stratum command with void 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/void.cfg')])
24
        output = command_tester.get_display()
25
26
        self.assertEqual(0, status)
27
        self.assertIn('Constants', output)
28
        self.assertIn('Loader', output)
29
        self.assertIn('Wrapper', output)
30
        self.assertNotIn('ERROR', output)
31
32
    # ------------------------------------------------------------------------------------------------------------------
33
    def test_command_constants(self) -> None:
34
        """
35
        Test constants command with void backend.
36
        """
37
        application = StratumApplication()
38
39
        command = application.find('constant')
40
        command_tester = CommandTester(command)
41
        status = command_tester.execute([('command', command.get_name()),
42
                                         ('config_file', 'test/etc/void.cfg')])
43
        output = command_tester.get_display()
44
45
        self.assertEqual(0, status)
46
        self.assertIn('Constants', output)
47
        self.assertNotIn('ERROR', output)
48
49
    # ------------------------------------------------------------------------------------------------------------------
50
    def test_command_loader(self) -> None:
51
        """
52
        Test constants command with void backend.
53
        """
54
        application = StratumApplication()
55
56
        command = application.find('loader')
57
        command_tester = CommandTester(command)
58
        status = command_tester.execute([('command', command.get_name()),
59
                                         ('config_file', 'test/etc/void.cfg')])
60
        output = command_tester.get_display()
61
62
        self.assertEqual(0, status)
63
        self.assertIn('Loader', output)
64
        self.assertNotIn('ERROR', output)
65
66
    # ------------------------------------------------------------------------------------------------------------------
67
    def test_command_wrapper(self) -> None:
68
        """
69
        Test constants command with void backend.
70
        """
71
        application = StratumApplication()
72
73
        command = application.find('wrapper')
74
        command_tester = CommandTester(command)
75
        status = command_tester.execute([('command', command.get_name()),
76
                                         ('config_file', 'test/etc/void.cfg')])
77
        output = command_tester.get_display()
78
79
        self.assertEqual(0, status)
80
        self.assertIn('Wrapper', output)
81
        self.assertNotIn('ERROR', output)
82
83
# ----------------------------------------------------------------------------------------------------------------------
84