diff --git a/backend/open_webui/test/test_oauth_google_groups.py b/backend/open_webui/test/test_oauth_google_groups.py index 0b3d5573b..9bc1de9af 100644 --- a/backend/open_webui/test/test_oauth_google_groups.py +++ b/backend/open_webui/test/test_oauth_google_groups.py @@ -19,14 +19,14 @@ class TestOAuthGoogleGroups: mock_response_data = { "memberships": [ { - "group": { - "groupKey": {"id": "admin@company.com"} - } + "groupKey": {"id": "admin@company.com"}, + "group": "groups/123", + "displayName": "Admin Group" }, { - "group": { - "groupKey": {"id": "users@company.com"} - } + "groupKey": {"id": "users@company.com"}, + "group": "groups/456", + "displayName": "Users Group" } ] } @@ -63,9 +63,9 @@ class TestOAuthGoogleGroups: mock_session.get.assert_called_once() call_args = mock_session.get.call_args - # Check the URL contains the user email + # Check the URL contains the user email (URL encoded) url_arg = call_args[0][0] # First positional argument - assert "user@company.com" in url_arg + assert "user%40company.com" in url_arg # @ is encoded as %40 assert "searchTransitiveGroups" in url_arg # Check headers contain the bearer token diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index b584070ff..f9d1122a8 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -577,8 +577,6 @@ class OAuthManager: log.debug(f"Updated profile picture for user {user.email}") if not user: - user_count = Users.get_num_users() - # If the user does not exist, check if signups are enabled if auth_manager_config.ENABLE_OAUTH_SIGNUP: # Check if an existing user with the same email already exists