diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 56ac1dd..cd2b2bf 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -25,6 +25,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" + - name: Configure apt proxy + run: | + set -euo pipefail + PROXY_HOST="http://apt-cacher:3142" + if ! curl -fsS --connect-timeout 3 "${PROXY_HOST}" >/dev/null; then + PROXY_HOST="http://192.168.88.14:3142" + fi + echo "Using APT proxy ${PROXY_HOST}" + echo "http_proxy=${PROXY_HOST}" >> "$GITHUB_ENV" + echo "https_proxy=${PROXY_HOST}" >> "$GITHUB_ENV" + echo "HTTP_PROXY=${PROXY_HOST}" >> "$GITHUB_ENV" + echo "HTTPS_PROXY=${PROXY_HOST}" >> "$GITHUB_ENV" + sudo tee /etc/apt/apt.conf.d/01proxy >/dev/null < 0 - cid = currencies[0]["id"] + assert any(c["id"] == seeded_currency.id for c in currencies) payload = { "scenario_id": sid, "amount": 120.0, "description": "Opex with explicit id", - "currency_id": cid, + "currency_id": seeded_currency.id, } - resp = client.post("/api/costs/opex", json=payload) + resp = api_client.post("/api/costs/opex", json=payload) assert resp.status_code == 200 data = resp.json() - assert data["currency_id"] == cid + assert data["currency_id"] == seeded_currency.id -def test_list_currencies_endpoint(): - resp = client.get("/api/currencies/") +def test_list_currencies_endpoint(api_client, seeded_currency): + resp = api_client.get("/api/currencies/") assert resp.status_code == 200 data = resp.json() assert isinstance(data, list) - assert all("id" in c and "code" in c for c in data) + assert any(c["id"] == seeded_currency.id for c in data)