Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
fix pkce
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Dec 20, 2023
1 parent db3a7cb commit fd3316b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion geocity/tests/accounts/custom_oauth2_test_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from urllib.parse import parse_qs, urlparse

import requests
from allauth.socialaccount import app_settings
from allauth.socialaccount.tests import MockedResponse, OAuth2TestsMixin


Expand All @@ -12,7 +13,6 @@ class CustomOAuth2TestsMixin(OAuth2TestsMixin):
https://github.com/pennersr/django-allauth/blob/main/allauth/socialaccount/tests/__init__.py
"""

# TODO: PKCE is set at false manually. Need to remove this method, and try to fix test with another solution
def login(self, resp_mock=None, process="login", with_refresh_token=True):

with self.mocked_response():
Expand All @@ -22,6 +22,9 @@ def login(self, resp_mock=None, process="login", with_refresh_token=True):
p = urlparse(resp["location"])
q = parse_qs(p.query)

pkce_enabled = app_settings.PROVIDERS.get(self.app.provider, {}).get(
"OAUTH_PKCE_ENABLED", self.provider.pkce_enabled_default
)
pkce_enabled = False # Line changed

self.assertEqual("code_challenge" in q, pkce_enabled)
Expand Down

0 comments on commit fd3316b

Please sign in to comment.