From 0a2023624cc46e043f2936fcf18882d8b1ae885b Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Thu, 25 Apr 2024 23:21:33 +0200 Subject: [PATCH] feat: Upgrade django-allauth --- dj_rest_auth/registration/serializers.py | 2 +- dj_rest_auth/tests/requirements.pip | 2 +- dj_rest_auth/tests/test_serializers.py | 5 +++-- setup.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dj_rest_auth/registration/serializers.py b/dj_rest_auth/registration/serializers.py index db095cf..eef0bfb 100644 --- a/dj_rest_auth/registration/serializers.py +++ b/dj_rest_auth/registration/serializers.py @@ -119,7 +119,7 @@ def validate(self, attrs): ) provider = adapter.get_provider() - scope = provider.get_scope(request) + scope = provider.get_scope_from_request(request) client = self.client_class( request, app.client_id, diff --git a/dj_rest_auth/tests/requirements.pip b/dj_rest_auth/tests/requirements.pip index 214895e..16084f7 100644 --- a/dj_rest_auth/tests/requirements.pip +++ b/dj_rest_auth/tests/requirements.pip @@ -1,5 +1,5 @@ coveralls==1.11.1 -django-allauth==0.61.1 +django-allauth[socialaccount]==0.62.1 djangorestframework-simplejwt>=5.3.1 flake8==3.8.4 responses==0.12.1 diff --git a/dj_rest_auth/tests/test_serializers.py b/dj_rest_auth/tests/test_serializers.py index 74f9281..21806a7 100644 --- a/dj_rest_auth/tests/test_serializers.py +++ b/dj_rest_auth/tests/test_serializers.py @@ -1,6 +1,6 @@ from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter -from allauth.socialaccount.providers.facebook.views import FacebookProvider +from allauth.socialaccount.providers.facebook.provider import FacebookProvider from allauth.socialaccount.models import SocialApp from allauth.core.exceptions import ImmediateHttpResponse from django.contrib.auth import get_user_model @@ -119,6 +119,7 @@ class TestSocialLoginSerializer(TestCase): def setUpTestData(cls): cls.request_data = {"access_token": "token1234"} cls.request = APIRequestFactory().post(cls.request_data, format='json') + cls.request.session = {} social_app = SocialApp.objects.create( provider='facebook', name='Facebook', @@ -148,7 +149,7 @@ def test_validate_no_adpapter_class_present(self): serializer.is_valid() self.assertDictEqual(serializer.errors, self.NO_ADAPTER_CLASS_PRESENT) - @patch('allauth.socialaccount.providers.facebook.views.fb_complete_login') + @patch('allauth.socialaccount.providers.facebook.flows.complete_login') @patch('allauth.socialaccount.adapter.DefaultSocialAccountAdapter.pre_social_login') def test_immediate_http_response_error(self, mock_pre_social_login, mock_fb_complete_login): dummy_view = SocialLoginView() diff --git a/setup.py b/setup.py index 91f50c4..a0843bf 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ 'djangorestframework>=3.13.0', ], extras_require={ - 'with_social': ['django-allauth>=0.56.0,<0.62.0'], + 'with_social': ['django-allauth[socialaccount]>=0.62.0,<=0.62.1'], }, tests_require=[ 'coveralls>=1.11.1',