From 893c99bca1880c7a0edc3319ee7a21ae4d0d4e0a Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:39:10 -0700 Subject: [PATCH] test(photon): stub token validation in setup tests to avoid network Maintainer follow-up: _cmd_setup now validates existing tokens (#72763 salvage); the pre-existing setup tests monkeypatch a stored token, so without stubbing check_photon_token_valid they'd hit the real dashboard API and hang. --- tests/plugins/platforms/photon/test_setup_access.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/plugins/platforms/photon/test_setup_access.py b/tests/plugins/platforms/photon/test_setup_access.py index 177674b6543b..5d35fe5c8fca 100644 --- a/tests/plugins/platforms/photon/test_setup_access.py +++ b/tests/plugins/platforms/photon/test_setup_access.py @@ -73,6 +73,8 @@ def test_env_enablement_home_channel_defaults_name(monkeypatch: pytest.MonkeyPat def test_setup_hint_uses_gateway_service_command(monkeypatch: pytest.MonkeyPatch, capsys) -> None: monkeypatch.setattr(cli.photon_auth, "load_photon_token", lambda: "token") + # Token validation (added for #72763) would otherwise hit the network. + monkeypatch.setattr(cli.photon_auth, "check_photon_token_valid", lambda token: True) # The dashboard id *is* the Spectrum project id (ids unified), so setup no # longer enables Spectrum or fetches a separate spectrumProjectId — it # reuses this id directly. @@ -128,6 +130,8 @@ def test_setup_reuses_valid_existing_secret( return "new_secret" monkeypatch.setattr(cli.photon_auth, "load_photon_token", lambda: "token") + # Token validation (added for #72763) would otherwise hit the network. + monkeypatch.setattr(cli.photon_auth, "check_photon_token_valid", lambda token: True) monkeypatch.setattr(cli.photon_auth, "load_dashboard_project_id", lambda: "dashboard") monkeypatch.setattr( cli.photon_auth, @@ -173,6 +177,8 @@ def test_setup_regenerates_when_existing_secret_invalid( ) -> None: """When existing credentials are invalid, setup must regenerate.""" monkeypatch.setattr(cli.photon_auth, "load_photon_token", lambda: "token") + # Token validation (added for #72763) would otherwise hit the network. + monkeypatch.setattr(cli.photon_auth, "check_photon_token_valid", lambda token: True) monkeypatch.setattr(cli.photon_auth, "load_dashboard_project_id", lambda: "dashboard") monkeypatch.setattr( cli.photon_auth,