diff --git a/app/services/auth.py b/app/services/auth.py index 596b6ba..adeb210 100644 --- a/app/services/auth.py +++ b/app/services/auth.py @@ -28,8 +28,6 @@ def get_password_hash(password): def get_user(db, username: str): user = db.exec(select(UserDB).where(UserDB.name == username)).first() - if user is None: - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Username not found in get_user, this shouldn't happen") return user def authenticate_user(db, username: str, password: str): diff --git a/test/test_services/test_auth.py b/test/test_services/test_auth.py index 353b753..9b490b8 100644 --- a/test/test_services/test_auth.py +++ b/test/test_services/test_auth.py @@ -40,9 +40,8 @@ def test_get_user(db_session): assert retrieved_user.name == "testuser" # Try to get non-existent user - with pytest.raises(HTTPException) as exc_info: - get_user(db_session, "nonexistent") - assert exc_info.value.status_code == status.HTTP_404_NOT_FOUND + retrieved_user = get_user(db_session, "nonexistent") + assert retrieved_user is None def test_authenticate_user(db_session):