Skip to content

Commit d3ba563

Browse files
author
Marcel Körtgen
committed
test: finish slo-export integration test
1 parent 9fec525 commit d3ba563

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
FROM python:3-slim as base
1+
FROM python:3-slim AS base
22
WORKDIR /app
33

4-
FROM base as deps
4+
FROM base AS deps
55
COPY requirements.txt ./
66
RUN pip install --no-cache-dir -r requirements.txt
77

8-
FROM deps as test
8+
FROM deps AS test
99
COPY requirements-dev.txt ./
1010
RUN pip install --no-cache-dir -r requirements-dev.txt
1111
COPY . .
1212
RUN python -m pytest --mypy --cov --cov-fail-under=75
1313

14-
FROM deps as final
14+
FROM deps AS final
1515
COPY . .
1616
# Dummy dependency to prevent optimizing away the test stage (Buildkit)
1717
COPY --from=test /app/README.md ./README.md

src/tests/slo/test_api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import json
2-
3-
import pytest
1+
from pandas import DataFrame
2+
from pytest_mock import MockFixture
43
from starlette.testclient import TestClient
54

65
from config.settings import settings
6+
from slo.service import get_slo_service
7+
from tests.utils import patch_of
78

9+
def test_slo_export(client: TestClient, mocker: MockFixture) -> None:
10+
p = patch_of(mocker, get_slo_service().get_slo_window) # type: ignore
11+
df = DataFrame()
12+
p.return_value = df
813

9-
def test_slo_export(client: TestClient) -> None:
1014
path = f"{settings.api_base}/slo/export"
11-
response = client.get(f"{path}/csv")
15+
response = client.get(f"{path}/csv?update=true")
1216
assert response.status_code == 200
1317
assert response.headers["Content-Type"] == "text/csv; charset=utf-8"
1418
assert response.headers["Content-Disposition"] == 'attachment; filename="slo-reporting.csv"'

0 commit comments

Comments
 (0)