forked from pool/python-social-auth-core
(gh#python-social-auth/social-core#500) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-social-auth-core?expand=0&rev=23
583 lines
23 KiB
Diff
583 lines
23 KiB
Diff
---
|
|
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
|
|
|
|
from jose import jwt
|
|
from jose.jwk import RSAKey
|
|
@@ -138,7 +139,7 @@ class OpenIdConnectTestMixin(object):
|
|
if tamper_message:
|
|
header, msg, sig = body['id_token'].split('.')
|
|
id_token['sub'] = '1235'
|
|
- msg = base64.encodestring(json.dumps(id_token).encode()).decode()
|
|
+ msg = base64.encodebytes(json.dumps(id_token).encode()).decode()
|
|
body['id_token'] = '.'.join([header, msg, sig])
|
|
|
|
return json.dumps(body)
|
|
@@ -147,7 +148,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/backends/test_vk.py
|
|
+++ b/social_core/tests/backends/test_vk.py
|
|
@@ -21,7 +21,7 @@ class VKOAuth2Test(OAuth2Test):
|
|
'last_name': 'Дуров',
|
|
'screen_name': 'durov',
|
|
'nickname': '',
|
|
- 'photo': "http:\/\/cs7003.vk.me\/v7003815\/22a1\/xgG9fb-IJ3Y.jpg"
|
|
+ 'photo': "http:\\/\\/cs7003.vk.me\\/v7003815\\/22a1\\/xgG9fb-IJ3Y.jpg"
|
|
}]
|
|
})
|
|
|
|
--- a/social_core/tests/models.py
|
|
+++ b/social_core/tests/models.py
|
|
@@ -49,19 +49,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
|
|
@@ -166,7 +166,7 @@ class TestAssociation(AssociationMixin,
|
|
if assoc is None:
|
|
assoc = TestAssociation(server_url=server_url,
|
|
handle=association.handle)
|
|
- assoc.secret = base64.encodestring(association.secret)
|
|
+ assoc.secret = base64.encodebytes(association.secret)
|
|
assoc.issued = association.issued
|
|
assoc.lifetime = association.lifetime
|
|
assoc.assoc_type = association.assoc_type
|
|
@@ -219,7 +219,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
|
|
@@ -2,7 +2,6 @@ import re
|
|
import sys
|
|
import time
|
|
import unicodedata
|
|
-import collections
|
|
import functools
|
|
import hmac
|
|
import logging
|
|
@@ -19,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'
|
|
|
|
@@ -111,7 +114,7 @@ def sanitize_redirect(hosts, redirect_to
|
|
|
|
def user_is_authenticated(user):
|
|
if user and hasattr(user, 'is_authenticated'):
|
|
- if isinstance(user.is_authenticated, collections.Callable):
|
|
+ if isinstance(user.is_authenticated, Callable):
|
|
authenticated = user.is_authenticated()
|
|
else:
|
|
authenticated = user.is_authenticated
|
|
@@ -124,7 +127,7 @@ def user_is_authenticated(user):
|
|
|
|
def user_is_active(user):
|
|
if user and hasattr(user, 'is_active'):
|
|
- if isinstance(user.is_active, collections.Callable):
|
|
+ if isinstance(user.is_active, Callable):
|
|
is_active = user.is_active()
|
|
else:
|
|
is_active = user.is_active
|
|
--- 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):
|