test fixes
This commit is contained in:
@@ -113,36 +113,32 @@ class TestDatabaseDependency:
|
||||
"""Test cases for database session dependency injection."""
|
||||
|
||||
def test_get_database_session_not_implemented(self):
|
||||
"""Test that database session dependency is not yet implemented."""
|
||||
"""Test that database session dependency is async generator."""
|
||||
import inspect
|
||||
|
||||
# Test that function exists and is an async generator function
|
||||
assert inspect.isfunction(get_database_session)
|
||||
assert inspect.iscoroutinefunction(get_database_session)
|
||||
|
||||
# Since it immediately raises an exception,
|
||||
# we can't test the actual async behavior easily
|
||||
assert inspect.isasyncgenfunction(get_database_session)
|
||||
|
||||
|
||||
class TestAuthenticationDependencies:
|
||||
"""Test cases for authentication dependency injection."""
|
||||
|
||||
def test_get_current_user_not_implemented(self):
|
||||
"""Test that current user dependency is not yet implemented."""
|
||||
"""Test that current user dependency rejects invalid tokens."""
|
||||
# Arrange
|
||||
credentials = HTTPAuthorizationCredentials(
|
||||
scheme="Bearer",
|
||||
credentials="test-token"
|
||||
credentials="invalid-token"
|
||||
)
|
||||
|
||||
# Act & Assert
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
get_current_user(credentials)
|
||||
|
||||
# Should raise 401 for invalid token
|
||||
assert (exc_info.value.status_code ==
|
||||
status.HTTP_501_NOT_IMPLEMENTED)
|
||||
assert ("Authentication functionality not yet implemented" in
|
||||
str(exc_info.value.detail))
|
||||
status.HTTP_401_UNAUTHORIZED)
|
||||
|
||||
def test_require_auth_with_user(self):
|
||||
"""Test require_auth dependency with authenticated user."""
|
||||
|
||||
Reference in New Issue
Block a user