From c56144882d0de30f6e79d987c9b99ec8e626db2e Mon Sep 17 00:00:00 2001 From: a7hu-15 Date: Sat, 4 Jul 2026 10:33:08 +0530 Subject: [PATCH 1/2] chore: add pre-commit configuration hooks --- .pre-commit-config.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..46a3e617 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.7 + hooks: + - id: ruff + args: [ --fix ] From d142c007222537e08df98f052a019972986c70a7 Mon Sep 17 00:00:00 2001 From: a7hu-15 Date: Sat, 4 Jul 2026 10:33:20 +0530 Subject: [PATCH 2/2] test: initialize backend pytest infrastructure --- backend/pytest.ini | 5 +++++ backend/tests/__init__.py | 1 + backend/tests/conftest.py | 8 ++++++++ backend/tests/test_main.py | 15 +++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 backend/pytest.ini create mode 100644 backend/tests/__init__.py create mode 100644 backend/tests/conftest.py create mode 100644 backend/tests/test_main.py diff --git a/backend/pytest.ini b/backend/pytest.ini new file mode 100644 index 00000000..2c4a62f4 --- /dev/null +++ b/backend/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +asyncio_mode = auto +testpaths = tests +python_files = test_*.py +addopts = -v --cov=app --cov-report=term-missing diff --git a/backend/tests/__init__.py b/backend/tests/__init__.py new file mode 100644 index 00000000..70fa9fea --- /dev/null +++ b/backend/tests/__init__.py @@ -0,0 +1 @@ +"""Test module initialization.""" diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py new file mode 100644 index 00000000..208275f2 --- /dev/null +++ b/backend/tests/conftest.py @@ -0,0 +1,8 @@ +import pytest +from fastapi.testclient import TestClient +from app.main import app + +@pytest.fixture(scope="session") +def client(): + with TestClient(app) as c: + yield c diff --git a/backend/tests/test_main.py b/backend/tests/test_main.py new file mode 100644 index 00000000..1bc554da --- /dev/null +++ b/backend/tests/test_main.py @@ -0,0 +1,15 @@ +def test_root(client): + response = client.get("/") + assert response.status_code == 200 + assert response.json() == { + "name": "DevLink API", + "version": "1.0.0", + "status": "running", + } + +def test_health(client): + response = client.get("/health") + assert response.status_code == 200 + data = response.json() + assert data["status"] == "healthy" + assert "environment" in data