mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
feat(docs): report.md update and refactored tests
This commit is contained in:
@@ -3,17 +3,6 @@ import pytest
|
||||
from httpx import AsyncClient, ASGITransport
|
||||
|
||||
|
||||
def test_root_ok(client):
|
||||
resp = client.get("/")
|
||||
assert resp.status_code == status.HTTP_200_OK
|
||||
assert resp.json() == {"status": "ok"}
|
||||
|
||||
|
||||
def test_authenticated_route_requires_auth(client):
|
||||
resp = client.get("/authenticated-route")
|
||||
assert resp.status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_and_get_category(fastapi_app, test_user):
|
||||
# Use AsyncClient for async tests
|
||||
@@ -165,6 +154,6 @@ async def test_delete_transaction_not_found(fastapi_app, test_user):
|
||||
async with AsyncClient(transport=transport, base_url="http://testserver") as ac:
|
||||
token = (await ac.post("/auth/jwt/login", data=test_user)).json()["access_token"]
|
||||
h = {"Authorization": f"Bearer {token}"}
|
||||
r = await ac.delete("/transactions/999999/delete", headers=h)
|
||||
r = await ac.delete("/transactions/9999999/delete", headers=h)
|
||||
assert r.status_code == status.HTTP_404_NOT_FOUND
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import types
|
||||
import asyncio
|
||||
import pytest
|
||||
|
||||
from fastapi import status
|
||||
from app.services import user_service
|
||||
|
||||
|
||||
@@ -22,6 +20,15 @@ def test_get_jwt_strategy_lifetime():
|
||||
# Basic smoke check: strategy has a lifetime set to 604800
|
||||
assert getattr(strategy, "lifetime_seconds", None) in (604800,)
|
||||
|
||||
def test_root_ok(client):
|
||||
resp = client.get("/")
|
||||
assert resp.status_code == status.HTTP_200_OK
|
||||
assert resp.json() == {"status": "ok"}
|
||||
|
||||
|
||||
def test_authenticated_route_requires_auth(client):
|
||||
resp = client.get("/authenticated-route")
|
||||
assert resp.status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_on_after_request_verify_enqueues_email(monkeypatch):
|
||||
|
||||
@@ -55,7 +55,7 @@ to a background worker service via the Message queue.
|
||||
- The stored transactions are encrypted in the DB for security reasons.
|
||||
- For every pull request the full APP is deployed on a separate URL and the tests are run by github CI/CD
|
||||
- On every push to main, the production app is automatically updated
|
||||
-
|
||||
- UI is responsive for mobile devices
|
||||
|
||||
### Components
|
||||
|
||||
@@ -281,13 +281,13 @@ bash test-with-ephemeral-mariadb.sh
|
||||
|
||||
|
||||
### Unit Tests
|
||||
There are only 3 basic unit tests, since our services logic is very simple
|
||||
There are only 5 basic unit tests, since our services logic is very simple
|
||||
```bash
|
||||
bash test-with-ephemeral-mariadb.sh --only-unit
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
There are 11 basic unit tests, testing the individual backend API logic
|
||||
There are 9 basic unit tests, testing the individual backend API logic
|
||||
```bash
|
||||
bash test-with-ephemeral-mariadb.sh --only-integration
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user