1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
from receptorctl import cli as commands
# The goal is to write tests following the click documentation:
# https://click.palletsprojects.com/en/8.0.x/testing/
import pytest
@pytest.mark.usefixtures("receptor_mesh_mesh1")
class TestCLI:
def test_cli_cmd_status(self, invoke_as_json):
result, json_output = invoke_as_json(commands.status, [])
assert result.exit_code == 0
assert set(
[
"Advertisements",
"Connections",
"KnownConnectionCosts",
"NodeID",
"RoutingTable",
"SystemCPUCount",
"SystemMemoryMiB",
"Version",
]
) == set(
json_output.keys()
), "The command returned unexpected keys from json output"
|