Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/test_cli_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ def test_whoami_auth_error_exit_4(monkeypatch):
assert "Unauthorized" in result.output


def test_whoami_unconfigured_exit_2(monkeypatch):
def test_whoami_unconfigured_exit_2(monkeypatch, tmp_path):
monkeypatch.delenv("WAGTAIL_CLI_BASE_URL", raising=False)
monkeypatch.delenv("WAGTAIL_CLI_TOKEN", raising=False)
# Isolate from any real ~/.wagtail-cli.toml or project dotfile on this machine.
monkeypatch.setattr(
"wagtail_cli.config._user_dotfile", lambda: tmp_path / ".wagtail-cli.toml"
)
monkeypatch.setattr(
"wagtail_cli.config._project_dotfile", lambda: tmp_path / ".wagtail-cli.toml"
)
result = runner.invoke(app, ["--url", BASE, "api", "whoami"]) # url but no token
assert result.exit_code == 2
assert "wt api init" in result.output
Expand Down
Loading