refactor(auth): improve code structure and add user registration endpoint
refactor(main): update index route response and remove greeting service refactor(decorators): streamline authentication decorators and remove unused ones test(routes): update tests to reflect changes in main routes and error messages
This commit is contained in:
@@ -21,19 +21,7 @@ class TestMainRoutes:
|
||||
"""Test the index route."""
|
||||
response = client.get("/api/")
|
||||
assert response.status_code == 200
|
||||
assert response.get_json() == {"message": "Hello from backend!"}
|
||||
|
||||
def test_hello_route_without_name(self, client) -> None:
|
||||
"""Test hello route without name parameter."""
|
||||
response = client.get("/api/hello")
|
||||
assert response.status_code == 200
|
||||
assert response.get_json() == {"message": "Hello from backend!"}
|
||||
|
||||
def test_hello_route_with_name(self, client) -> None:
|
||||
"""Test hello route with name parameter."""
|
||||
response = client.get("/api/hello/Alice")
|
||||
assert response.status_code == 200
|
||||
assert response.get_json() == {"message": "Hello, Alice!"}
|
||||
assert response.get_json() == {"message": "API is running", "status": "ok"}
|
||||
|
||||
def test_health_route(self, client) -> None:
|
||||
"""Test health check route."""
|
||||
@@ -46,4 +34,4 @@ class TestMainRoutes:
|
||||
response = client.get("/api/protected")
|
||||
assert response.status_code == 401
|
||||
data = response.get_json()
|
||||
assert data["error"] == "Authentication required"
|
||||
assert data["error"] == "Authentication required (JWT or API token)"
|
||||
Reference in New Issue
Block a user