Skip to content

Commit

Permalink
add integration test for debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
ykim-akamai committed Nov 18, 2024
1 parent 1299418 commit 05e24c5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/integration/cli/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from tests.integration.helpers import (
contains_at_least_one_of,
exec_failing_test_command,
exec_test_command,
)

Expand Down Expand Up @@ -50,3 +51,30 @@ def test_help_page_for_aliased_actions():

assert "You may filter results with:" in wrapped_output
assert "--tags" in wrapped_output


def test_debug_output_contains_request_url(monkeypatch: pytest.MonkeyPatch):
env_vars = {
"LINODE_CLI_API_HOST": "api.linode.com",
"LINODE_CLI_API_VERSION": "v4",
"LINODE_CLI_API_SCHEME": "https",
}
for key, value in env_vars.items():
monkeypatch.setenv(key, value)

output = exec_failing_test_command(
[
"linode-cli",
"linodes",
"update",
"--label",
"foobar",
"12345",
"--debug",
]
).stderr.decode()
wrapped_output = textwrap.fill(output, width=180).replace("\n", "")

assert (
"PUT https://api.linode.com/v4/linode/instances/12345" in wrapped_output
)

0 comments on commit 05e24c5

Please sign in to comment.