Skip to content

Commit cd7eac9

Browse files
committed
Fix tests
1 parent af9f5ff commit cd7eac9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

infrahub_sdk/ctl/cli_commands.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ def info( # noqa: PLR0915
409409
_: str = CONFIG_PARAM,
410410
) -> None:
411411
"""Display the status of the Python SDK."""
412-
413412
info: dict[str, Any] = {
414413
"error": None,
415414
"status": ":x:",

tests/unit/ctl/test_cli.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_version_command() -> None:
3333

3434

3535
def test_info_command_success(mock_query_infrahub_version, mock_query_infrahub_user) -> None:
36-
result = runner.invoke(app, ["info"])
36+
result = runner.invoke(app, ["info"], env={"INFRAHUB_API_TOKEN": "foo"})
3737
assert result.exit_code == 0
3838
for expected in ["Connection Status", "Python Version", "SDK Version", "Infrahub Version"]:
3939
assert expected in result.stdout, f"'{expected}' not found in info command output"
@@ -46,15 +46,16 @@ def test_info_command_failure() -> None:
4646

4747

4848
def test_info_detail_command_success(mock_query_infrahub_version, mock_query_infrahub_user) -> None:
49+
result = runner.invoke(app, ["info", "--detail"], env={"INFRAHUB_API_TOKEN": "foo"})
50+
assert result.exit_code == 0
51+
for expected in ["Connection Status", "Version Information", "Client Info", "Infrahub Info", "Groups:"]:
52+
assert expected in result.stdout, f"'{expected}' not found in detailed info command output"
53+
54+
55+
def test_anonymous_info_detail_command_success(mock_query_infrahub_version) -> None:
4956
result = runner.invoke(app, ["info", "--detail"])
5057
assert result.exit_code == 0
51-
for expected in [
52-
"Connection Status",
53-
"Version Information",
54-
"Client Info",
55-
"Infrahub Info",
56-
"Groups:",
57-
]:
58+
for expected in ["Connection Status", "Version Information", "Client Info", "Infrahub Info", "anonymous"]:
5859
assert expected in result.stdout, f"'{expected}' not found in detailed info command output"
5960

6061

0 commit comments

Comments
 (0)