Skip to content

Commit

Permalink
Tests to verify mock show outputs
Browse files Browse the repository at this point in the history
Show Output verification for:
show chassis-modules status
show chassis-modules midplane-status
  • Loading branch information
mprabhu-nokia committed Jan 12, 2021
1 parent 4701b00 commit a754ad5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/chassis_modules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,36 @@
header_lines = 2
warning_lines = 0

show_chassis_modules_output="""\
Name Description Physical-Slot Oper-Status Admin-Status
------------ --------------- --------------- ------------- --------------
FABRIC-CARD0 fabric-card 17 Online up
FABRIC-CARD1 fabric-card 18 Offline up
LINE-CARD0 line-card 1 Empty up
LINE-CARD1 line-card 2 Online down
SUPERVISOR0 supervisor-card 16 Online up
"""

show_chassis_midplane_output="""\
Name IP-Address Reachability
----------- ------------- --------------
LINE-CARD0 192.168.1.1 True
LINE-CARD1 192.168.1.2 False
SUPERVISOR0 192.168.1.100 True
"""

class TestChassisModules(object):
@classmethod
def setup_class(cls):
print("SETUP")
os.environ["UTILITIES_UNIT_TESTING"] = "1"

def test_show_and_verify_output(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["chassis-modules"].commands["status"], [])
print(result.output)
assert(result.output == show_chassis_modules_output)

def test_show_all_count_lines(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["chassis-modules"].commands["status"], [])
Expand Down Expand Up @@ -112,6 +136,12 @@ def test_config_incorrect_module(self):
print(result.output)
assert result.exit_code != 0

def test_show_and_verify_midplane_output(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["chassis-modules"].commands["midplane-status"], [])
print(result.output)
assert(result.output == show_chassis_midplane_output)

def test_midplane_show_all_count_lines(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["chassis-modules"].commands["midplane-status"], [])
Expand Down

0 comments on commit a754ad5

Please sign in to comment.