Skip to content

Commit a754ad5

Browse files
committed
Tests to verify mock show outputs
Show Output verification for: show chassis-modules status show chassis-modules midplane-status
1 parent 4701b00 commit a754ad5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/chassis_modules_test.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,36 @@
2121
header_lines = 2
2222
warning_lines = 0
2323

24+
show_chassis_modules_output="""\
25+
Name Description Physical-Slot Oper-Status Admin-Status
26+
------------ --------------- --------------- ------------- --------------
27+
FABRIC-CARD0 fabric-card 17 Online up
28+
FABRIC-CARD1 fabric-card 18 Offline up
29+
LINE-CARD0 line-card 1 Empty up
30+
LINE-CARD1 line-card 2 Online down
31+
SUPERVISOR0 supervisor-card 16 Online up
32+
"""
33+
34+
show_chassis_midplane_output="""\
35+
Name IP-Address Reachability
36+
----------- ------------- --------------
37+
LINE-CARD0 192.168.1.1 True
38+
LINE-CARD1 192.168.1.2 False
39+
SUPERVISOR0 192.168.1.100 True
40+
"""
41+
2442
class TestChassisModules(object):
2543
@classmethod
2644
def setup_class(cls):
2745
print("SETUP")
2846
os.environ["UTILITIES_UNIT_TESTING"] = "1"
2947

48+
def test_show_and_verify_output(self):
49+
runner = CliRunner()
50+
result = runner.invoke(show.cli.commands["chassis-modules"].commands["status"], [])
51+
print(result.output)
52+
assert(result.output == show_chassis_modules_output)
53+
3054
def test_show_all_count_lines(self):
3155
runner = CliRunner()
3256
result = runner.invoke(show.cli.commands["chassis-modules"].commands["status"], [])
@@ -112,6 +136,12 @@ def test_config_incorrect_module(self):
112136
print(result.output)
113137
assert result.exit_code != 0
114138

139+
def test_show_and_verify_midplane_output(self):
140+
runner = CliRunner()
141+
result = runner.invoke(show.cli.commands["chassis-modules"].commands["midplane-status"], [])
142+
print(result.output)
143+
assert(result.output == show_chassis_midplane_output)
144+
115145
def test_midplane_show_all_count_lines(self):
116146
runner = CliRunner()
117147
result = runner.invoke(show.cli.commands["chassis-modules"].commands["midplane-status"], [])

0 commit comments

Comments
 (0)