diff --git a/app/controllers/aaManager.py b/app/controllers/aaManager.py index 024e4cd..c1de3fd 100644 --- a/app/controllers/aaManager.py +++ b/app/controllers/aaManager.py @@ -14,7 +14,7 @@ aa_router = APIRouter(prefix="/aa", tags=["AccessAuth"]) @aa_router.post("/", response_model=AccessAuthorizationResponse) def add_accessauth(*, db: Session = Depends(get_session), aa: AccessAuthorizationCreate, admin: bool = Depends(auth_is_admin)): - logger.info("Creating accessauth with data: ", aa) + logger.info(f"Creating accessauth with data: {aa}") timetables = [Timetable.model_validate(t) for t in aa.timetables] db_aa = AccessAuthorizationDB( name=aa.name, diff --git a/app/controllers/userManager.py b/app/controllers/userManager.py index 09eca7e..7abe7c6 100644 --- a/app/controllers/userManager.py +++ b/app/controllers/userManager.py @@ -12,7 +12,7 @@ user_router = APIRouter(tags=["Users"]) @user_router.post("/users/", response_model=UserResponse) def create_user(*, db: Session = Depends(get_session), user: UserCreate, admin: bool = Depends(auth_is_admin)): - logger.info("creating user with data ", user) + logger.info(f"creating user with data: {user}") hashed_password = {"passwordhash": get_password_hash(user.password)} db_user = UserDB.model_validate(user, update=hashed_password) return add_and_refresh(db, db_user) diff --git a/app/services/auth.py b/app/services/auth.py index 75090ec..ba73e69 100644 --- a/app/services/auth.py +++ b/app/services/auth.py @@ -90,7 +90,7 @@ def create_first_user(db: Session): admin_user = db.exec(select(UserDB)).first() if admin_user is None: password = ''.join(secrets.choice(string.digits) for i in range(8)) - logger.info("Creating first admin user with password", password) + logger.info(f"Creating first admin user with password: {password}") user = UserDB( name="admin", passwordhash=get_password_hash(password), diff --git a/test/test_services/test_auth.py b/test/test_services/test_auth.py index e4f3798..07d8200 100644 --- a/test/test_services/test_auth.py +++ b/test/test_services/test_auth.py @@ -131,7 +131,6 @@ def test_auth_is_admin(db_session, admin_user, regular_user): def test_create_first_user(db_session): """Test automatic creation of first admin user.""" - #Currently broken because this uses the prod db because of how i wrote the create_first_user function # Clear any existing users from sqlmodel import select db_session.exec(select(UserDB)).all()