Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
backends: Fix type errors.
Anders Kaseorgec3d18765904
diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.pyindex 14da69a541a..13b65c1c25c 100644--- a/zerver/tests/test_auth_backends.py+++ b/zerver/tests/test_auth_backends.py@@ -3449,7 +3449,6 @@ class SAMLAuthBackendTest(SocialAuthBase):class AppleAuthMixin:- BACKEND_CLASS = AppleAuthBackendCLIENT_KEY_SETTING = "SOCIAL_AUTH_APPLE_KEY"AUTHORIZATION_URL = "https://appleid.apple.com/auth/authorize"ACCESS_TOKEN_URL = "https://appleid.apple.com/auth/token"@@ -3486,6 +3485,7 @@ class AppleAuthMixin:class AppleIdAuthBackendTest(AppleAuthMixin, SocialAuthBase):+ BACKEND_CLASS = AppleAuthBackendLOGIN_URL = "/accounts/login/social/apple"SIGNUP_URL = "/accounts/register/social/apple"@@ -3619,6 +3619,7 @@ class AppleIdAuthBackendTest(AppleAuthMixin, SocialAuthBase):class AppleAuthBackendNativeFlowTest(AppleAuthMixin, SocialAuthBase):+ BACKEND_CLASS = AppleAuthBackendSIGNUP_URL = "/complete/apple/"LOGIN_URL = "/complete/apple/"diff --git a/zproject/backends.py b/zproject/backends.pyindex 8a9b91aa572..407bd9c8204 100644--- a/zproject/backends.py+++ b/zproject/backends.py@@ -1715,7 +1715,7 @@ def social_auth_sync_user_attributes(def social_associate_user_helper(- backend: BaseAuth, return_data: dict[str, Any], *args: Any, **kwargs: Any+ backend: "SocialAuthMixin", return_data: dict[str, Any], *args: Any, **kwargs: Any) -> HttpResponse | UserProfile | None:"""Responsible for doing the Zulip account lookup and validation partsof the Zulip social auth pipeline (similar to the authenticate()@@ -1875,6 +1875,7 @@ def social_auth_associate_user(later stages of settings.SOCIAL_AUTH_PIPELINE, such associal_auth_finish, as kwargs."""+ assert isinstance(backend, SocialAuthMixin)partial_token = backend.strategy.request_data().get("partial_token")return_data: dict[str, Any] = {}user_profile = social_associate_user_helper(backend, return_data, *args, **kwargs)@@ -2213,15 +2214,15 @@ class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2):**kwargs,)elif team_id is not None:- backend = GithubTeamOAuth2(self.strategy, self.redirect_uri)+ team_backend = GithubTeamOAuth2(self.strategy, self.redirect_uri)try:- return backend.user_data(access_token, *args, **kwargs)+ return team_backend.user_data(access_token, *args, **kwargs)except AuthFailed:return dict(auth_failed_reason="GitHub user is not member of required team")elif org_name is not None:- backend = GithubOrganizationOAuth2(self.strategy, self.redirect_uri)+ organization_backend = GithubOrganizationOAuth2(self.strategy, self.redirect_uri)try:- return backend.user_data(access_token, *args, **kwargs)+ return organization_backend.user_data(access_token, *args, **kwargs)except AuthFailed:return dict(auth_failed_reason="GitHub user is not member of required organization")