14
0

Accepting request 879178 from home:mcalabkova:branches:devel:languages:python

- Update to 4.1.0
  * Dropped Python 2 support from testing stack
  * Discourse backend
  * Osso backend
  * Use strategies as interface to fetch backends
  * PayPal backend
  * Fence OIDC-based backend
- Drop merged resolve_depreciations.patch, remove-unittest2.patch
  and saml_config.json

OBS-URL: https://build.opensuse.org/request/show/879178
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-social-auth-core?expand=0&rev=27
This commit is contained in:
2021-03-15 13:59:30 +00:00
committed by Git OBS Bridge
parent 6119e90e73
commit d9434c720e
7 changed files with 28 additions and 758 deletions

View File

@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Mar 15 10:30:41 UTC 2021 - Markéta Machová <mmachova@suse.com>
- Update to 4.1.0
* Dropped Python 2 support from testing stack
* Discourse backend
* Osso backend
* Use strategies as interface to fetch backends
* PayPal backend
* Fence OIDC-based backend
- Drop merged resolve_depreciations.patch, remove-unittest2.patch
and saml_config.json
-------------------------------------------------------------------
Tue Dec 22 23:02:37 UTC 2020 - Matej Cepl <mcepl@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-social-auth-core
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2017-2018 Matthias Fehring <buschmann23@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
@@ -18,61 +18,42 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
%define skip_python2 1
%define modname social-core
Name: python-social-auth-core
Version: 3.4.0
Version: 4.1.0
Release: 0
Summary: Python Social Auth Core
License: BSD-3-Clause
Group: Development/Languages/Python
Source: https://github.com/python-social-auth/%{modname}/archive/%{version}.tar.gz#/%{modname}-%{version}.tar.gz
# Missing test data https://github.com/python-social-auth/social-core/pull/351
Source1: https://raw.githubusercontent.com/python-social-auth/social-core/master/social_core/tests/backends/data/saml_config.json
Patch0: remove-unittest2.patch
# PATCH-FEATURE-UPSTREAM resolve_depreciations.patch gh#python-social-auth/social-core#500 mcepl@suse.com
# Remove deprecation warnings
Patch1: resolve_depreciations.patch
BuildRequires: %{python_module PyJWT >= 1.4.0}
BuildRequires: %{python_module Unidecode >= 1.1.1}
BuildRequires: %{python_module PyJWT >= 2.0.0}
BuildRequires: %{python_module coverage >= 3.6}
BuildRequires: %{python_module cryptography >= 2.1.1}
BuildRequires: %{python_module defusedxml >= 0.5.0}
BuildRequires: %{python_module httpretty}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module oauthlib >= 1.0.3}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-jose >= 3.0.0}
BuildRequires: %{python_module python3-saml}
BuildRequires: %{python_module rednose >= 0.4.1}
BuildRequires: %{python_module python3-openid >= 3.0.10}
BuildRequires: %{python_module python3-saml >= 1.2.1}
BuildRequires: %{python_module requests >= 2.9.1}
BuildRequires: %{python_module requests-oauthlib >= 0.6.1}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six >= 1.10.0}
BuildRequires: ca-certificates
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with python2}
BuildRequires: python2-python-openid >= 2.2.5
%endif
BuildRequires: python3-defusedxml >= 0.5.0
BuildRequires: python3-python3-openid >= 3.0.10
Requires: python-PyJWT >= 1.4.0
Requires: python-Unidecode >= 1.1.1
Requires: python-PyJWT >= 2.0.0
Requires: python-cryptography >= 2.1.1
Requires: python-oauthlib >= 1.0.3
Requires: python-python-jose >= 3.0.0
Requires: python-requests >= 2.9.1
Requires: python-requests-oauthlib >= 0.6.1
Requires: python-six >= 1.10.0
BuildArch: noarch
%ifpython2
Requires: python2-python-openid >= 2.2.5
%endif
%ifpython3
Requires: python3-defusedxml >= 0.5.0
Requires: python3-python3-openid >= 3.0.10
Recommends: python-python3-saml
%endif
Requires: python-defusedxml >= 0.5.0
Requires: python-python3-openid >= 3.0.10
Recommends: python-python3-saml >= 1.2.1
%python_subpackages
%description
@@ -87,8 +68,6 @@ storage solutions.
%prep
%autosetup -p1 -n %{modname}-%{version}
cp %{SOURCE1} social_core/tests/backends/data/
%build
%python_build
@@ -100,7 +79,7 @@ cp %{SOURCE1} social_core/tests/backends/data/
# python3 only: assertRaisesRegexp -> assertRaisesRegex
# skipped tests are online based
rm -rf _build.python2
python3 -m pytest -v -k 'not (test_login or test_partial_pipeline)'
%pytest -k 'not (test_login or test_partial_pipeline)'
%files %{python_files}
%doc CHANGELOG.md README.md

View File

@@ -1,172 +0,0 @@
Index: social-auth-core-3.1.0/social_core/tests/__init__.py
===================================================================
--- /dev/null
+++ social-auth-core-3.1.0/social_core/tests/__init__.py
@@ -0,0 +1,6 @@
+try:
+ import unittest2
+ import sys
+ sys.modules['unittest'] = unittest2
+except ImportError:
+ pass
Index: social-auth-core-3.1.0/social_core/tests/actions/actions.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/actions/actions.py
+++ social-auth-core-3.1.0/social_core/tests/actions/actions.py
@@ -1,6 +1,6 @@
import json
import requests
-import unittest2 as unittest
+import unittest
from httpretty import HTTPretty
Index: social-auth-core-3.1.0/social_core/tests/backends/base.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/base.py
+++ social-auth-core-3.1.0/social_core/tests/backends/base.py
@@ -1,4 +1,4 @@
-import unittest2 as unittest
+import unittest
import requests
from httpretty import HTTPretty
Index: social-auth-core-3.1.0/social_core/tests/backends/open_id_connect.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/open_id_connect.py
+++ social-auth-core-3.1.0/social_core/tests/backends/open_id_connect.py
@@ -3,7 +3,7 @@ import os
import sys
import json
import datetime
-import unittest2
+import unittest
import base64
from calendar import timegm
Index: social-auth-core-3.1.0/social_core/tests/backends/test_broken.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_broken.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_broken.py
@@ -1,4 +1,4 @@
-import unittest2 as unittest
+import unittest
from ...backends.base import BaseAuth
from ..strategy import TestStrategy
Index: social-auth-core-3.1.0/social_core/tests/backends/test_elixir.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_elixir.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_elixir.py
@@ -1,4 +1,4 @@
-import unittest2
+import unittest
from .oauth import OAuth1Test, OAuth2Test
from .open_id_connect import OpenIdConnectTestMixin
Index: social-auth-core-3.1.0/social_core/tests/backends/test_globus.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_globus.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_globus.py
@@ -1,5 +1,5 @@
import json
-import unittest2
+import unittest
from .oauth import OAuth1Test, OAuth2Test
from .open_id_connect import OpenIdConnectTestMixin
Index: social-auth-core-3.1.0/social_core/tests/backends/test_google.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_google.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_google.py
@@ -1,6 +1,6 @@
import datetime
import json
-import unittest2
+import unittest
from httpretty import HTTPretty
Index: social-auth-core-3.1.0/social_core/tests/backends/test_saml.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_saml.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_saml.py
@@ -1,7 +1,7 @@
import re
import json
import sys
-import unittest2
+import unittest
import requests
import os
from os import path
@@ -28,11 +28,11 @@ from ...exceptions import AuthMissingPar
DATA_DIR = path.join(path.dirname(__file__), 'data')
-@unittest2.skipIf('TRAVIS' in os.environ,
- 'Travis-ci segfaults probably due to a bad '
- 'dependencies build')
-@unittest2.skipIf('__pypy__' in sys.builtin_module_names,
- 'dm.xmlsec not compatible with pypy')
+@unittest.skipIf('TRAVIS' in os.environ,
+ 'Travis-ci segfaults probably due to a bad '
+ 'dependencies build')
+@unittest.skipIf('__pypy__' in sys.builtin_module_names,
+ 'dm.xmlsec not compatible with pypy')
class SAMLTest(BaseBackendTest):
backend_path = 'social_core.backends.saml.SAMLAuth'
expected_username = 'myself'
Index: social-auth-core-3.1.0/social_core/tests/backends/test_utils.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/backends/test_utils.py
+++ social-auth-core-3.1.0/social_core/tests/backends/test_utils.py
@@ -1,4 +1,4 @@
-import unittest2 as unittest
+import unittest
from ..models import TestStorage
from ..strategy import TestStrategy
Index: social-auth-core-3.1.0/social_core/tests/test_exceptions.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/test_exceptions.py
+++ social-auth-core-3.1.0/social_core/tests/test_exceptions.py
@@ -1,4 +1,4 @@
-import unittest2 as unittest
+import unittest
from ..exceptions import SocialAuthBaseException, WrongBackend, \
AuthFailed, AuthTokenError, \
Index: social-auth-core-3.1.0/social_core/tests/test_partial.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/test_partial.py
+++ social-auth-core-3.1.0/social_core/tests/test_partial.py
@@ -1,4 +1,4 @@
-import unittest2 as unittest
+import unittest
try:
from mock import Mock, patch
except ImportError:
Index: social-auth-core-3.1.0/social_core/tests/test_storage.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/test_storage.py
+++ social-auth-core-3.1.0/social_core/tests/test_storage.py
@@ -1,6 +1,6 @@
import six
import random
-import unittest2 as unittest
+import unittest
from ..strategy import BaseStrategy
from ..storage import UserMixin, NonceMixin, AssociationMixin, \
Index: social-auth-core-3.1.0/social_core/tests/test_utils.py
===================================================================
--- social-auth-core-3.1.0.orig/social_core/tests/test_utils.py
+++ social-auth-core-3.1.0/social_core/tests/test_utils.py
@@ -1,5 +1,5 @@
import sys
-import unittest2 as unittest
+import unittest
try:
from unittest.mock import Mock

View File

@@ -1,527 +0,0 @@
---
social_core/tests/actions/test_associate.py | 3 +
social_core/tests/backends/open_id_connect.py | 5 +-
social_core/tests/backends/test_broken.py | 9 ++--
social_core/tests/backends/test_utils.py | 3 +
social_core/tests/backends/test_vk.py | 2 -
social_core/tests/models.py | 10 ++---
social_core/tests/strategy.py | 6 +--
social_core/tests/test_storage.py | 52 +++++++++++++-------------
social_core/utils.py | 9 +++-
9 files changed, 53 insertions(+), 46 deletions(-)
--- a/social_core/tests/actions/test_associate.py
+++ b/social_core/tests/actions/test_associate.py
@@ -1,4 +1,5 @@
import json
+import six
from ...exceptions import AuthAlreadyAssociated
@@ -82,6 +83,6 @@ class AlreadyAssociatedErrorTest(BaseAct
self.user = self.user1
self.do_login()
self.user = User(username='foobar2', email='foo2@bar2.com')
- with self.assertRaisesRegex(AuthAlreadyAssociated,
+ with six.assertRaisesRegex(self, AuthAlreadyAssociated,
'This account is already in use.'):
self.do_login()
--- a/social_core/tests/backends/open_id_connect.py
+++ b/social_core/tests/backends/open_id_connect.py
@@ -6,6 +6,7 @@ import datetime
import unittest
import base64
from calendar import timegm
+import six
import six
from jose import jwt
@@ -151,7 +152,7 @@ class OpenIdConnectTestMixin(object):
self.access_token_body = self.prepare_access_token_body(
**access_token_kwargs
)
- with self.assertRaisesRegex(AuthTokenError, expected_message):
+ with six.assertRaisesRegex(self, AuthTokenError, expected_message):
self.do_login()
def test_invalid_signature(self):
--- a/social_core/tests/backends/test_broken.py
+++ b/social_core/tests/backends/test_broken.py
@@ -1,7 +1,8 @@
import unittest
+import six
from ...backends.base import BaseAuth
-from ..strategy import TestStrategy
+from ..strategy import _TestStrategy
from ..models import TestStorage
@@ -11,27 +12,27 @@ class BrokenBackendAuth(BaseAuth):
class BrokenBackendTest(unittest.TestCase):
def setUp(self):
- self.backend = BrokenBackendAuth(TestStrategy(TestStorage))
+ self.backend = BrokenBackendAuth(_TestStrategy(TestStorage))
def tearDown(self):
self.backend = None
def test_auth_url(self):
- with self.assertRaisesRegex(NotImplementedError,
+ with six.assertRaisesRegex(self, NotImplementedError,
'Implement in subclass'):
self.backend.auth_url()
def test_auth_html(self):
- with self.assertRaisesRegex(NotImplementedError,
+ with six.assertRaisesRegex(self, NotImplementedError,
'Implement in subclass'):
self.backend.auth_html()
def test_auth_complete(self):
- with self.assertRaisesRegex(NotImplementedError,
+ with six.assertRaisesRegex(self, NotImplementedError,
'Implement in subclass'):
self.backend.auth_complete()
def test_get_user_details(self):
- with self.assertRaisesRegex(NotImplementedError,
+ with six.assertRaisesRegex(self, NotImplementedError,
'Implement in subclass'):
self.backend.get_user_details(None)
--- a/social_core/tests/backends/test_utils.py
+++ b/social_core/tests/backends/test_utils.py
@@ -1,7 +1,8 @@
import unittest
+import six
from ..models import TestStorage
-from ..strategy import TestStrategy
+from ..strategy import _TestStrategy
from ...backends.utils import load_backends, get_backend
from ...backends.github import GithubOAuth2
from ...exceptions import MissingBackend
@@ -9,7 +10,7 @@ from ...exceptions import MissingBackend
class BaseBackendUtilsTest(unittest.TestCase):
def setUp(self):
- self.strategy = TestStrategy(storage=TestStorage)
+ self.strategy = _TestStrategy(storage=TestStorage)
def tearDown(self):
self.strategy = None
@@ -40,7 +41,7 @@ class GetBackendTest(BaseBackendUtilsTes
self.assertEqual(backend, GithubOAuth2)
def test_get_missing_backend(self):
- with self.assertRaisesRegex(MissingBackend,
+ with six.assertRaisesRegex(self, MissingBackend,
'Missing backend "foobar" entry'):
get_backend(('social_core.backends.github.GithubOAuth2',
'social_core.backends.facebook.FacebookOAuth2',
--- a/social_core/tests/test_storage.py
+++ b/social_core/tests/test_storage.py
@@ -50,35 +50,35 @@ class BrokenUserTests(unittest.TestCase)
self.user = None
def test_get_username(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.get_username(User('foobar'))
def test_user_model(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.user_model()
def test_username_max_length(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.username_max_length()
def test_get_user(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.get_user(1)
def test_get_social_auth(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.get_social_auth('foo', 1)
def test_get_social_auth_for_user(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.get_social_auth_for_user(User('foobar'))
def test_create_social_auth(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.create_social_auth(User('foobar'), 1, 'foo')
def test_disconnect(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.user.disconnect(BrokenUser())
@@ -90,15 +90,15 @@ class BrokenAssociationTests(unittest.Te
self.association = None
def test_store(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.association.store('http://foobar.com', BrokenAssociation())
def test_get(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.association.get()
def test_remove(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.association.remove([1, 2, 3])
@@ -110,7 +110,7 @@ class BrokenNonceTests(unittest.TestCase
self.nonce = None
def test_use(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.nonce.use('http://foobar.com', 1364951922, 'foobar123')
@@ -122,7 +122,7 @@ class BrokenCodeTest(unittest.TestCase):
self.code = None
def test_get_code(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.code.get_code('foobar')
@@ -134,56 +134,56 @@ class BrokenStrategyTests(unittest.TestC
self.strategy = None
def test_redirect(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.redirect('http://foobar.com')
def test_get_setting(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.get_setting('foobar')
def test_html(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.html('<p>foobar</p>')
def test_request_data(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.request_data()
def test_request_host(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.request_host()
def test_session_get(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.session_get('foobar')
def test_session_set(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.session_set('foobar', 123)
def test_session_pop(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.session_pop('foobar')
def test_build_absolute_uri(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.build_absolute_uri('/foobar')
def test_render_html_with_tpl(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.render_html('foobar.html', context={})
def test_render_html_with_html(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.render_html(html='<p>foobar</p>', context={})
def test_render_html_with_none(self):
- with self.assertRaisesRegex(ValueError,
+ with six.assertRaisesRegex(self, ValueError,
'Missing template or html parameters'):
self.strategy.render_html()
def test_is_integrity_error(self):
- with self.assertRaisesRegex(NotImplementedError, NOT_IMPLEMENTED_MSG):
+ with six.assertRaisesRegex(self, NotImplementedError, NOT_IMPLEMENTED_MSG):
self.strategy.storage.is_integrity_error(None)
def test_random_string(self):
--- a/social_core/tests/models.py
+++ b/social_core/tests/models.py
@@ -51,19 +51,19 @@ class User(BaseModel):
User.cache[self.username] = self
-class TestUserSocialAuth(UserMixin, BaseModel):
+class _TestUserSocialAuth(UserMixin, BaseModel):
NEXT_ID = 1
cache = {}
cache_by_uid = {}
def __init__(self, user, provider, uid, extra_data=None):
- self.id = TestUserSocialAuth.next_id()
+ self.id = _TestUserSocialAuth.next_id()
self.user = user
self.provider = provider
self.uid = uid
self.extra_data = extra_data or {}
self.user.social.append(self)
- TestUserSocialAuth.cache_by_uid[uid] = self
+ _TestUserSocialAuth.cache_by_uid[uid] = self
def save(self):
pass
@@ -224,7 +224,7 @@ class TestPartial(PartialMixin, BaseMode
class TestStorage(BaseStorage):
- user = TestUserSocialAuth
+ user = _TestUserSocialAuth
nonce = TestNonce
association = TestAssociation
code = TestCode
--- a/social_core/tests/strategy.py
+++ b/social_core/tests/strategy.py
@@ -18,14 +18,14 @@ class TestTemplateStrategy(BaseTemplateS
return html
-class TestStrategy(BaseStrategy):
+class _TestStrategy(BaseStrategy):
DEFAULT_TEMPLATE_STRATEGY = TestTemplateStrategy
def __init__(self, storage, tpl=None):
self._request_data = {}
self._settings = {}
self._session = {}
- super(TestStrategy, self).__init__(storage, tpl)
+ super(_TestStrategy, self).__init__(storage, tpl)
def redirect(self, url):
return Redirect(url)
@@ -100,7 +100,7 @@ class TestStrategy(BaseStrategy):
self._request_data.pop(name, None)
def authenticate(self, *args, **kwargs):
- user = super(TestStrategy, self).authenticate(*args, **kwargs)
+ user = super(_TestStrategy, self).authenticate(*args, **kwargs)
if isinstance(user, self.storage.user.user_model()):
self.session_set('username', user.username)
return user
--- a/social_core/utils.py
+++ b/social_core/utils.py
@@ -18,6 +18,10 @@ from requests.packages.urllib3.poolmanag
from .exceptions import AuthCanceled, AuthForbidden, AuthUnreachableProvider
+try:
+ from collections.abc import Callable
+except ImportError:
+ from collections import Callable
SETTING_PREFIX = 'SOCIAL_AUTH'
--- a/social_core/tests/actions/actions.py
+++ b/social_core/tests/actions/actions.py
@@ -8,9 +8,9 @@ from six.moves.urllib_parse import urlpa
from ...utils import parse_qs, module_member
from ...actions import do_auth, do_complete
-from ..models import TestStorage, User, TestUserSocialAuth, TestNonce, \
+from ..models import TestStorage, User, _TestUserSocialAuth, TestNonce, \
TestAssociation
-from ..strategy import TestStrategy
+from ..strategy import _TestStrategy
class BaseActionTest(unittest.TestCase):
@@ -61,11 +61,11 @@ class BaseActionTest(unittest.TestCase):
def setUp(self):
HTTPretty.enable()
User.reset_cache()
- TestUserSocialAuth.reset_cache()
+ _TestUserSocialAuth.reset_cache()
TestNonce.reset_cache()
TestAssociation.reset_cache()
Backend = module_member('social_core.backends.github.GithubOAuth2')
- self.strategy = self.strategy or TestStrategy(TestStorage)
+ self.strategy = self.strategy or _TestStrategy(TestStorage)
self.backend = Backend(self.strategy, redirect_uri='/complete/github')
self.user = None
@@ -75,7 +75,7 @@ class BaseActionTest(unittest.TestCase):
self.user = None
User.reset_cache()
User.set_active(True)
- TestUserSocialAuth.reset_cache()
+ _TestUserSocialAuth.reset_cache()
TestNonce.reset_cache()
TestAssociation.reset_cache()
HTTPretty.disable()
--- a/social_core/tests/backends/base.py
+++ b/social_core/tests/backends/base.py
@@ -5,8 +5,8 @@ from httpretty import HTTPretty
from ...utils import module_member, parse_qs, PARTIAL_TOKEN_SESSION_NAME
from ...backends.utils import user_backends_data, load_backends
-from ..strategy import TestStrategy
-from ..models import User, TestUserSocialAuth, TestNonce, \
+from ..strategy import _TestStrategy
+from ..models import User, _TestUserSocialAuth, TestNonce, \
TestAssociation, TestCode, TestStorage
@@ -20,7 +20,7 @@ class BaseBackendTest(unittest.TestCase)
def setUp(self):
HTTPretty.enable()
Backend = module_member(self.backend_path)
- self.strategy = TestStrategy(TestStorage)
+ self.strategy = _TestStrategy(TestStorage)
self.backend = Backend(self.strategy, redirect_uri=self.complete_url)
self.name = self.backend.name.upper().replace('-', '_')
self.complete_url = self.strategy.build_absolute_uri(
@@ -35,7 +35,7 @@ class BaseBackendTest(unittest.TestCase)
# Force backends loading to trash PSA cache
load_backends(backends, force_load=True)
User.reset_cache()
- TestUserSocialAuth.reset_cache()
+ _TestUserSocialAuth.reset_cache()
TestNonce.reset_cache()
TestAssociation.reset_cache()
TestCode.reset_cache()
@@ -47,7 +47,7 @@ class BaseBackendTest(unittest.TestCase)
self.name = None
self.complete_url = None
User.reset_cache()
- TestUserSocialAuth.reset_cache()
+ _TestUserSocialAuth.reset_cache()
TestNonce.reset_cache()
TestAssociation.reset_cache()
TestCode.reset_cache()
--- a/social_core/tests/actions/test_disconnect.py
+++ b/social_core/tests/actions/test_disconnect.py
@@ -6,7 +6,7 @@ from ...actions import do_disconnect
from ...exceptions import NotAllowedToDisconnect
from ...utils import parse_qs
-from ..models import User, TestUserSocialAuth
+from ..models import User, _TestUserSocialAuth
from .actions import BaseActionTest
@@ -29,7 +29,7 @@ class DisconnectActionTest(BaseActionTes
user = User.get(self.expected_username)
user.password = 'password'
association_id = user.social[0].id
- second_usa = TestUserSocialAuth(user, user.social[0].provider, "uid2")
+ second_usa = _TestUserSocialAuth(user, user.social[0].provider, "uid2")
self.assertEqual(len(user.social), 2)
do_disconnect(self.backend, user, association_id)
self.assertEqual(len(user.social), 1)
--- a/social_core/tests/backends/open_id.py
+++ b/social_core/tests/backends/open_id.py
@@ -10,8 +10,8 @@ from httpretty import HTTPretty
sys.path.insert(0, '..')
from .base import BaseBackendTest
-from ..strategy import TestStrategy
-from ..models import TestStorage, User, TestUserSocialAuth, \
+from ..strategy import _TestStrategy
+from ..models import TestStorage, User, _TestUserSocialAuth, \
TestNonce, TestAssociation
from ...utils import parse_qs, module_member
from ...backends.utils import load_backends
@@ -46,7 +46,7 @@ class OpenIdTest(BaseBackendTest):
def setUp(self):
HTTPretty.enable()
Backend = module_member(self.backend_path)
- self.strategy = TestStrategy(TestStorage)
+ self.strategy = _TestStrategy(TestStorage)
self.complete_url = self.raw_complete_url.format(Backend.name)
self.backend = Backend(self.strategy, redirect_uri=self.complete_url)
self.strategy.set_settings({
@@ -64,7 +64,7 @@ class OpenIdTest(BaseBackendTest):
def tearDown(self):
self.strategy = None
User.reset_cache()
- TestUserSocialAuth.reset_cache()
+ _TestUserSocialAuth.reset_cache()
TestNonce.reset_cache()
TestAssociation.reset_cache()
HTTPretty.disable()
--- a/social_core/tests/test_pipeline.py
+++ b/social_core/tests/test_pipeline.py
@@ -3,8 +3,8 @@ import json
from ..utils import PARTIAL_TOKEN_SESSION_NAME
from ..exceptions import AuthException
-from .models import TestUserSocialAuth, TestStorage, User
-from .strategy import TestStrategy
+from .models import _TestUserSocialAuth, TestStorage, User
+from .strategy import _TestStrategy
from .actions.actions import BaseActionTest
@@ -16,7 +16,7 @@ class UnknownError(Exception):
pass
-class IntegrityErrorUserSocialAuth(TestUserSocialAuth):
+class IntegrityErrorUserSocialAuth(_TestUserSocialAuth):
@classmethod
def create_social_auth(cls, user, uid, provider):
raise IntegrityError()
@@ -44,7 +44,7 @@ class IntegrityErrorStorage(TestStorage)
return isinstance(exception, IntegrityError)
-class UnknownErrorUserSocialAuth(TestUserSocialAuth):
+class UnknownErrorUserSocialAuth(_TestUserSocialAuth):
@classmethod
def create_social_auth(cls, user, uid, provider):
raise UnknownError()
@@ -56,7 +56,7 @@ class UnknownErrorStorage(IntegrityError
class IntegrityErrorOnLoginTest(BaseActionTest):
def setUp(self):
- self.strategy = TestStrategy(IntegrityErrorStorage)
+ self.strategy = _TestStrategy(IntegrityErrorStorage)
super(IntegrityErrorOnLoginTest, self).setUp()
def test_integrity_error(self):
@@ -65,7 +65,7 @@ class IntegrityErrorOnLoginTest(BaseActi
class UnknownErrorOnLoginTest(BaseActionTest):
def setUp(self):
- self.strategy = TestStrategy(UnknownErrorStorage)
+ self.strategy = _TestStrategy(UnknownErrorStorage)
super(UnknownErrorOnLoginTest, self).setUp()
def test_unknown_error(self):

View File

@@ -1,23 +0,0 @@
{
"SOCIAL_AUTH_SAML_SP_ENTITY_ID": "https://github.com/omab/python-social-auth/saml-test",
"SOCIAL_AUTH_SAML_SP_PUBLIC_CERT": "MIICsDCCAhmgAwIBAgIJAO7BwdjDZcUWMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNBMRkwFwYDVQQIExBCcml0aXNoIENvbHVtYmlhMRswGQYDVQQKExJweXRob24tc29jaWFsLWF1dGgwHhcNMTUwNTA4MDc1ODQ2WhcNMjUwNTA3MDc1ODQ2WjBFMQswCQYDVQQGEwJDQTEZMBcGA1UECBMQQnJpdGlzaCBDb2x1bWJpYTEbMBkGA1UEChMScHl0aG9uLXNvY2lhbC1hdXRoMIGfMA0GCSqGSIb3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kicq/VZcRyUqVbZbMwz05II3nqx3wJBAMsVhRQ5sdFCRBzEbSAm2YEJaFh5u6QT3+zWHMFpPJRnaBAWz3RXKEnleJ+DS2Xz1Jm6ZrmLdZiwMx/8dK5rDZECQQC7GTdWi7ZC3dIcpwaKIGHRhZxmda8ZMkc9Wwwd8H7I8aFUZFPCu0xEc7SXoHHACit8zyfwBYpvMN8gPK3JnOkfAkEAsUSpk0wBMT38one7IZOHzCDgGkq4RbKrhdon45Pus0PIDDM9BrqFimtpbSN4DxhVfZK91DwtfAhhuAvv9cewYQJAPMhpAqv3PBGYmtRDUlWXJQv2JRJJkrvbbqgBed2OX5RRgj5V3SR6PBhLbcTZ+q+1tdPkMFzZo5U6MN5m/6oXvQ==",
"SOCIAL_AUTH_SAML_ORG_INFO": {
"en-US": {"name": "psa", "displayname": "PSA", "url": "https://github.com/omab/python-social-auth/"}
},
"SOCIAL_AUTH_SAML_TECHNICAL_CONTACT":
{"givenName": "Tech Gal", "emailAddress": "technical@example.com"},
"SOCIAL_AUTH_SAML_SUPPORT_CONTACT":
{"givenName": "Support Guy", "emailAddress": "support@example.com"},
"SOCIAL_AUTH_SAML_ENABLED_IDPS": {
"testshib": {
"entity_id": "https://idp.testshib.org/idp/shibboleth",
"url": "https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO",
"x509cert": "MIIEDjCCAvagAwIBAgIBADANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJVUzEVMBMGA1UECBMMUGVubnN5bHZhbmlhMRMwEQYDVQQHEwpQaXR0c2J1cmdoMREwDwYDVQQKEwhUZXN0U2hpYjEZMBcGA1UEAxMQaWRwLnRlc3RzaGliLm9yZzAeFw0wNjA4MzAyMTEyMjVaFw0xNjA4MjcyMTEyMjVaMGcxCzAJBgNVBAYTAlVTMRUwEwYDVQQIEwxQZW5uc3lsdmFuaWExEzARBgNVBAcTClBpdHRzYnVyZ2gxETAPBgNVBAoTCFRlc3RTaGliMRkwFwYDVQQDExBpZHAudGVz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"https://unused.saml.example.com/SAML2/Redirect/SSO"
}
}
}

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:06e137cf87a23bd077541523833b29f481081dd7ee143651b758db701032e606
size 186742

3
social-core-4.1.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3398690b33e42f6be8637742f5b737d86aa406e8c966ef717a2dafa4afdce213
size 190830