chore: import upstream snapshot with attribution
CI / lint (push) Has been cancelled
CI / js-syntax (push) Successful in 10m24s
CI / deps-audit (push) Has been cancelled
CI / test (push) Failing after 24m55s
CI / sast-bandit (push) Failing after 11m13s
CI / trivy (push) Failing after 9m32s
Docker Publish / build-and-push (push) Failing after 34m3s
CI / lint (push) Has been cancelled
CI / js-syntax (push) Successful in 10m24s
CI / deps-audit (push) Has been cancelled
CI / test (push) Failing after 24m55s
CI / sast-bandit (push) Failing after 11m13s
CI / trivy (push) Failing after 9m32s
Docker Publish / build-and-push (push) Failing after 34m3s
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from app.core import settings as _settings
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolate_network_settings(tmp_path, monkeypatch):
|
||||
"""Isolate the runtime network gate for every test. Without this, a stray
|
||||
settings.json in the repo (written by a local dev server) could flip the
|
||||
gate off and 403 the whole suite, since TestClient's client host is not
|
||||
loopback. Each test starts from the env default (on, outside desktop mode)."""
|
||||
monkeypatch.setattr(_settings, "_SETTINGS_PATH", tmp_path / "settings.json")
|
||||
# Network access defaults OFF in production, which would 403 TestClient
|
||||
# (whose client host isn't loopback). Default the suite ON; gate tests set
|
||||
# it explicitly. Tests checking the real default clear this env var.
|
||||
monkeypatch.setenv("STEMDECK_ALLOW_NETWORK", "1")
|
||||
_settings._state = None # force a fresh load from the isolated path
|
||||
yield
|
||||
_settings._state = None
|
||||
Reference in New Issue
Block a user