Files
thomas 1f110866f5
CI / backend (pull_request) Canceled after 0s
CI / shell (pull_request) Canceled after 0s
CI / frontend (pull_request) Canceled after 0s
CI / arm64-smoke (pull_request) Canceled after 0s
CI / backend (push) Canceled after 0s
CI / shell (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / arm64-smoke (push) Canceled after 0s
Update docs and screenshots
2026-07-25 10:26:29 +02:00

38 lines
1.0 KiB
Python

import asyncio
import httpx
from app.fixtures.ofl import OflClient
def test_fetch_fixture_uses_json_endpoint(monkeypatch) -> None:
requested_urls: list[str] = []
class FakeResponse:
def raise_for_status(self) -> None:
return None
def json(self) -> dict[str, object]:
return {"name": "LED Bar-3 HCL Bar", "modes": []}
class FakeAsyncClient:
def __init__(self, *args, **kwargs) -> None:
pass
async def __aenter__(self) -> "FakeAsyncClient":
return self
async def __aexit__(self, exc_type, exc, tb) -> None:
return None
async def get(self, url: str) -> FakeResponse:
requested_urls.append(url)
return FakeResponse()
monkeypatch.setattr(httpx, "AsyncClient", FakeAsyncClient)
payload = asyncio.run(OflClient().fetch_fixture("eurolite", "led-bar-3-hcl-bar"))
assert payload["name"] == "LED Bar-3 HCL Bar"
assert requested_urls == ["https://open-fixture-library.org/eurolite/led-bar-3-hcl-bar.json"]