From 3342e05f1d4f01dc97d08afc8ba7acaff969e3f1 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/test_serializers.py | 7 ++----- setup.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/dj_rest_auth/registration/serializers.py b/dj_rest_auth/registration/serializers.py index db095cfc..eef0bfb2 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/test_serializers.py b/dj_rest_auth/tests/test_serializers.py index 9e86cf97..f89f7b76 100644 --- a/dj_rest_auth/tests/test_serializers.py +++ b/dj_rest_auth/tests/test_serializers.py @@ -120,10 +120,7 @@ class TestSocialLoginSerializer(TestCase): def setUpTestData(cls): cls.request_data = {"access_token": "token1234"} cls.request = APIRequestFactory().post(cls.request_data, format='json') - - middleware = SessionMiddleware(get_response=MagicMock()) - middleware(cls.request) - + cls.request.session = {} social_app = SocialApp.objects.create( provider='facebook', name='Facebook', @@ -153,7 +150,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.FacebookOAuth2Adapter.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 91f50c4b..a0843bfe 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',