Skip to content

Commit

Permalink
fix: pytest failure with user info
Browse files Browse the repository at this point in the history
  • Loading branch information
sujanadh committed Mar 12, 2024
1 parent 41e9efe commit 82a54bf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/backend/app/auth/auth_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def get_or_create_user(
{
"user_id": user_data.id,
"username": user_data.username,
"profile_img": user_data.img_url or None,
"profile_img": user_data.profile_img or None,
"role": "MAPPER",
"mapping_level": "BEGINNER",
"current_date": datetime.now(timezone.utc),
Expand Down Expand Up @@ -197,7 +197,7 @@ async def get_or_create_user(
{
"id": row.id,
"username": row.username,
"img_url": row.profile_img,
"profile_img": row.profile_img,
"role": row.role,
"project_id": row.project_id,
"project_role": row.project_role,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/auth/osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AuthUser(BaseModel):

id: int
username: str
img_url: Optional[str] = None
profile_img: Optional[str] = None
role: Optional[UserRole] = UserRole.MAPPER


Expand Down
6 changes: 3 additions & 3 deletions src/backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def admin_user(db):
),
)
# Upgrade role from default MAPPER (if user already exists)
db_user.role = UserRole.ADMIN
db_user["role"] = UserRole.ADMIN
db.commit()
return db_user

Expand Down Expand Up @@ -175,8 +175,8 @@ async def project(db, admin_user, organisation):
project_metadata,
odkproject["id"],
AuthUser(
username=admin_user.username,
id=admin_user.id,
username=admin_user["username"],
id=admin_user["id"],
role=UserRole.ADMIN,
),
)
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/utilfunctions/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const createLoginWindow = (redirectTo) => {
username: userRes.username,
osm_oauth_token: res.access_token,
id: userRes.id,
picture: userRes.img_url,
picture: userRes.profile_img,
redirect_to: redirectTo,
role: userRes.role,
}).toString();
Expand Down

0 comments on commit 82a54bf

Please sign in to comment.