Skip to content

Commit e69d0c7

Browse files
Implements Integration Tests (#65)
1 parent 99f55a2 commit e69d0c7

File tree

7 files changed

+26
-3
lines changed

7 files changed

+26
-3
lines changed

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pytest
2+
from fastapi.testclient import TestClient
3+
from typing import Iterator
4+
from app import app
5+
6+
7+
@pytest.fixture
8+
def client() -> Iterator[TestClient]:
9+
with TestClient(app) as client:
10+
yield client

dev.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ RUN apt-get update && \
88

99
VOLUME ["/app"]
1010

11-
COPY requirements.txt .
11+
COPY requirements*.txt .
1212

13-
RUN pip3 install --no-cache-dir -r requirements.txt
13+
RUN pip3 install --no-cache-dir -r requirements-dev.txt
1414

1515
COPY / .
1616

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-r requirements.txt
2+
httpx==0.25.0
3+
pytest==8.1.1

run-tests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker exec -it refinery-updater sh -c "cd /app && python3 -m pytest -v"

submodules/model

tests/__init__.py

Whitespace-only changes.

tests/test_app.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from fastapi.testclient import TestClient
2+
3+
4+
def test_healthcheck(client: TestClient):
5+
response = client.get("/healthcheck")
6+
assert response.status_code == 200
7+
assert response.text == "OK"

0 commit comments

Comments
 (0)