From e69b3bbb088cf78965ba4c1b83bbbbfee5d43d75 Mon Sep 17 00:00:00 2001 From: EremeevRA Date: Mon, 23 Mar 2026 14:07:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=D1=8B=20=D0=B8=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B2=20=D1=80=D0=B0=D0=BD=D0=BD=D0=B5=D1=80?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ api/tests/__init__.py | 2 ++ api/tests/test_app.py | 19 +++++++++++++++++++ requirements.txt | 2 ++ 4 files changed, 51 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 api/tests/__init__.py create mode 100644 api/tests/test_app.py diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..4126c27 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tests + run: | + pytest -q + diff --git a/api/tests/__init__.py b/api/tests/__init__.py new file mode 100644 index 0000000..09ba083 --- /dev/null +++ b/api/tests/__init__.py @@ -0,0 +1,2 @@ +"""Tests for the FastAPI app.""" + diff --git a/api/tests/test_app.py b/api/tests/test_app.py new file mode 100644 index 0000000..779c697 --- /dev/null +++ b/api/tests/test_app.py @@ -0,0 +1,19 @@ +from fastapi.testclient import TestClient + +from api.main import app + + +client = TestClient(app) + + +def test_health() -> None: + resp = client.get("/health") + assert resp.status_code == 200 + assert resp.json() == {"status": "ok"} + + +def test_root() -> None: + resp = client.get("/") + assert resp.status_code == 200 + assert resp.json() == {"message": "FastAPI is running"} + diff --git a/requirements.txt b/requirements.txt index 364e2ee..a00c8f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ fastapi uvicorn[standard] +pytest +httpx