Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: match signatures of refresh_identity and get_refresh_token_params #85698

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asottile-sentry
Copy link
Member

No description provided.

@asottile-sentry asottile-sentry requested review from a team February 21, 2025 22:17
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 21, 2025
Copy link

codecov bot commented Feb 21, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
23629 2 23627 290
View the top 2 failed test(s) by shortest run time
tests.sentry.integrations.gitlab.test_client.GitlabRefreshAuthTest::test_refresh_auth_fails_gracefully
Stack Traces | 1.34s run time
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:270: in _request
    resp.raise_for_status()
#x1B[1m#x1B[31m.venv/lib/python3.13.../site-packages/requests/models.py#x1B[0m:1024: in raise_for_status
    raise HTTPError(http_error_msg, response=self)
#x1B[1m#x1B[31mE   requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://example.gitlab..../api/v4/user#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:133: in _issue_request_with_auto_token_refresh
    response = super().request(*args, **kwargs)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:333: in request
    return self._request(*args, **kwargs)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:298: in _request
    raise ApiError.from_response(error_resp, url=full_url) from e
#x1B[1m#x1B[31mE   sentry.shared_integrations.exceptions.ApiUnauthorized: {}#x1B[0m

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
#x1B[1m#x1B[.../integrations/gitlab/test_client.py#x1B[0m:147: in test_refresh_auth_fails_gracefully
    self.make_users_request()
#x1B[1m#x1B[.../integrations/gitlab/test_client.py#x1B[0m:70: in make_users_request
    return self.gitlab_client.get_user()
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:168: in get_user
    return self.get(GitLabApiClientPath.user)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:367: in get
    return self.request("GET", *args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:129: in request
    return self._issue_request_with_auto_token_refresh(*args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:137: in _issue_request_with_auto_token_refresh
    return self._attempt_request_after_refreshing_token(*args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:154: in _attempt_request_after_refreshing_token
    self.refreshed_identity = self._refresh_auth()
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:114: in _refresh_auth
    return self.identity.get_identity().refresh_identity(
#x1B[1m#x1B[.../identity/gitlab/provider.py#x1B[0m:106: in refresh_identity
    data = self.get_refresh_token_params(refresh_token=refresh_token, identity=identity)
#x1B[1m#x1B[.../identity/gitlab/provider.py#x1B[0m:85: in get_refresh_token_params
    client_id = identity.data["client_id"]
#x1B[1m#x1B[31mE   KeyError: 'client_id'#x1B[0m
tests.sentry.integrations.gitlab.test_client.GitlabRefreshAuthTest::test_refresh_auth_flow
Stack Traces | 1.35s run time
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:270: in _request
    resp.raise_for_status()
#x1B[1m#x1B[31m.venv/lib/python3.13.../site-packages/requests/models.py#x1B[0m:1024: in raise_for_status
    raise HTTPError(http_error_msg, response=self)
#x1B[1m#x1B[31mE   requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://example.gitlab..../api/v4/user#x1B[0m

#x1B[33mThe above exception was the direct cause of the following exception:#x1B[0m
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:133: in _issue_request_with_auto_token_refresh
    response = super().request(*args, **kwargs)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:333: in request
    return self._request(*args, **kwargs)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:298: in _request
    raise ApiError.from_response(error_resp, url=full_url) from e
#x1B[1m#x1B[31mE   sentry.shared_integrations.exceptions.ApiUnauthorized: {}#x1B[0m

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m
#x1B[1m#x1B[.../integrations/gitlab/test_client.py#x1B[0m:136: in test_refresh_auth_flow
    resp = self.make_users_request()
#x1B[1m#x1B[.../integrations/gitlab/test_client.py#x1B[0m:70: in make_users_request
    return self.gitlab_client.get_user()
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:168: in get_user
    return self.get(GitLabApiClientPath.user)
#x1B[1m#x1B[.../shared_integrations/client/base.py#x1B[0m:367: in get
    return self.request("GET", *args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:129: in request
    return self._issue_request_with_auto_token_refresh(*args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:137: in _issue_request_with_auto_token_refresh
    return self._attempt_request_after_refreshing_token(*args, **kwargs)
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:154: in _attempt_request_after_refreshing_token
    self.refreshed_identity = self._refresh_auth()
#x1B[1m#x1B[.../integrations/gitlab/client.py#x1B[0m:114: in _refresh_auth
    return self.identity.get_identity().refresh_identity(
#x1B[1m#x1B[.../identity/gitlab/provider.py#x1B[0m:106: in refresh_identity
    data = self.get_refresh_token_params(refresh_token=refresh_token, identity=identity)
#x1B[1m#x1B[.../identity/gitlab/provider.py#x1B[0m:85: in get_refresh_token_params
    client_id = identity.data["client_id"]
#x1B[1m#x1B[31mE   KeyError: 'client_id'#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant