Setup project, started outlining endpoints and tests.

This commit is contained in:
Sparkchaser13 committed 2026-09-23 16:00:14 -06:00
commit 33cd28376d
41 files changed
+5177

No files matched your search

View File
Whitespace-only changes.
+15
View File
@@ -0,0 +1,15 @@
"""Fixtures to import into tests."""
from collections.abc import Iterator
import pytest
from fastapi.testclient import TestClient
from app.main import app
@pytest.fixture
def client() -> Iterator[TestClient]:
"""Client fixture to pass test client with."""
with TestClient(app) as client:
yield client
+13
View File
@@ -0,0 +1,13 @@
"""Unit tests for main.py."""
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_status_check() -> None:
"""Tests that status check returns 200."""
response = client.get("/")
assert response.status_code == 200
Whitespace-only changes.
+46
View File
@@ -0,0 +1,46 @@
"""Tests to check that auth endpoints are wired up."""
from fastapi.testclient import TestClient
def test_post_auth_login_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/login returns a successful response."""
response = client.post("/api/auth/login")
assert response.status_code == 200
def test_post_auth_refresh_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/refresh returns a successful response."""
response = client.post("/api/auth/refresh")
assert response.status_code == 200
def test_post_auth_logout_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/logout returns a successful response."""
response = client.post("/api/auth/logout")
assert response.status_code == 200
def test_post_auth_invite_accept_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/invite/accept returns a successful response."""
response = client.post("/api/auth/invite/accept")
assert response.status_code == 200
def test_post_auth_password_reset_request_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/password-reset/request returns a successful response."""
response = client.post("/api/auth/password-reset/request")
assert response.status_code == 200
def test_post_auth_password_reset_confirm_returns_200(client: TestClient) -> None:
"""Verify POST /api/auth/password-reset/confirm returns a successful response."""
response = client.post("/api/auth/password-reset/confirm")
assert response.status_code == 200
def test_get_auth_self_returns_200(client: TestClient) -> None:
"""Verify get /api/auth/{user_id} returns a successful response."""
response = client.get("/api/auth/123")
assert response.status_code == 200
+66
View File
@@ -0,0 +1,66 @@
"""One stop shop to check endpoints."""
from fastapi.testclient import TestClient
def test_get_users_returns_200(client: TestClient) -> None:
"""Verify GET /api/users returns a successful response."""
response = client.get("/api/users")
assert response.status_code == 200
def test_post_user_invite_returns_200(client: TestClient) -> None:
"""Verify POST /api/users/invite returns a successful response."""
response = client.post("/api/users/invite")
assert response.status_code == 200
def test_get_user_by_id_returns_200(client: TestClient) -> None:
"""Verify GET /api/users/{id} returns a successful response."""
response = client.get("/api/users/123")
assert response.status_code == 200
def test_patch_user_by_id_returns_200(client: TestClient) -> None:
"""Verify PATCH /api/users/{id} returns a successful response."""
response = client.patch("/api/users/123")
assert response.status_code == 200
def test_deactivate_user_returns_200(client: TestClient) -> None:
"""Verify POST /api/users/{id}/deactivate returns a successful response."""
response = client.post("/api/users/123/deactivate")
assert response.status_code == 200
def test_reactivate_user_returns_200(client: TestClient) -> None:
"""Verify POST /api/users/{id}/reactivate returns a successful response."""
response = client.post("/api/users/123/reactivate")
assert response.status_code == 200
def test_resend_user_invite_returns_200(client: TestClient) -> None:
"""Verify POST /api/users/{id}/resend-invite returns a successful response."""
response = client.post("/api/users/123/resend-invite")
assert response.status_code == 200
def test_export_current_user_returns_200(client: TestClient) -> None:
"""Verify GET /api/users/me/export returns a successful response."""
response = client.get("/api/users/123/export")
assert response.status_code == 200
def test_delete_user_returns_200(client: TestClient) -> None:
"""Verify DELETE /api/users/{id} returns a successful response."""
response = client.delete("/api/users/123")
assert response.status_code == 200