Skip to content

Commit f9d560d

Browse files
committed
fix: Catch error when parsing GH user groups
The social account uid is returned as a string, so this check never matched and users weren't added to their corresponding group.
1 parent 0bcf0ec commit f9d560d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/shared/auth/github_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def sync_groups_with_github_teams(self) -> None:
7474
)
7575
continue
7676

77-
github_user_id = social.uid
77+
github_user_id = int(social.uid)
7878

7979
if github_user_id in gh_security_team_ids:
8080
user.groups.add(self.security_group)

src/shared/tests/test_github_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
# Mock classes
1919
class MockGithubUser:
2020
def __init__(self, id_value: str) -> None:
21-
self.id: str = id_value
21+
self.id: int = int(id_value)
2222

2323

2424
class MockGithubTeam:
2525
def __init__(self, id: int, user_ids: list[str]) -> None:
26-
self.user_ids = user_ids
26+
self.user_ids = [int(uid) for uid in user_ids]
2727
self.id = id
2828

2929
def get_members(self) -> list[MockGithubUser]:
30-
return [MockGithubUser(id_value=id) for id in self.user_ids]
30+
return [MockGithubUser(id_value=str(id)) for id in self.user_ids]
3131

3232
def has_in_members(self, named_user: MockGithubUser) -> bool:
3333
return named_user.id in self.user_ids

0 commit comments

Comments
 (0)