File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
- FROM python:3-slim as base
1
+ FROM python:3-slim AS base
2
2
WORKDIR /app
3
3
4
- FROM base as deps
4
+ FROM base AS deps
5
5
COPY requirements.txt ./
6
6
RUN pip install --no-cache-dir -r requirements.txt
7
7
8
- FROM deps as test
8
+ FROM deps AS test
9
9
COPY requirements-dev.txt ./
10
10
RUN pip install --no-cache-dir -r requirements-dev.txt
11
11
COPY . .
12
12
RUN python -m pytest --mypy --cov --cov-fail-under=75
13
13
14
- FROM deps as final
14
+ FROM deps AS final
15
15
COPY . .
16
16
# Dummy dependency to prevent optimizing away the test stage (Buildkit)
17
17
COPY --from=test /app/README.md ./README.md
Original file line number Diff line number Diff line change 1
- import json
2
-
3
- import pytest
1
+ from pandas import DataFrame
2
+ from pytest_mock import MockFixture
4
3
from starlette .testclient import TestClient
5
4
6
5
from config .settings import settings
6
+ from slo .service import get_slo_service
7
+ from tests .utils import patch_of
7
8
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
8
13
9
- def test_slo_export (client : TestClient ) -> None :
10
14
path = f"{ settings .api_base } /slo/export"
11
- response = client .get (f"{ path } /csv" )
15
+ response = client .get (f"{ path } /csv?update=true " )
12
16
assert response .status_code == 200
13
17
assert response .headers ["Content-Type" ] == "text/csv; charset=utf-8"
14
18
assert response .headers ["Content-Disposition" ] == 'attachment; filename="slo-reporting.csv"'
You can’t perform that action at this time.
0 commit comments