import sys from unittest import mock from click.testing import CliRunner sys.path.append('../cli/show/plugins/') import show_macsec class TestShowMACsec(object): def test_plugin_registration(self): cli = mock.MagicMock() show_macsec.register(cli) cli.add_command.assert_called_once_with(show_macsec.macsec) def test_show_all(self): runner = CliRunner() result = runner.invoke(show_macsec.macsec,[]) assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info) def test_show_one_port(self): runner = CliRunner() result = runner.invoke(show_macsec.macsec,["Ethernet1"]) assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)