/usr/lib/python3/dist-packages/social/tests/backends/test_utils.py is in python3-social-auth 0.2.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import unittest2 as unittest
from social.tests.models import TestStorage
from social.tests.strategy import TestStrategy
from social.backends.utils import load_backends, get_backend
from social.backends.github import GithubOAuth2
from social.exceptions import MissingBackend
class BaseBackendUtilsTest(unittest.TestCase):
def setUp(self):
self.strategy = TestStrategy(storage=TestStorage)
def tearDown(self):
self.strategy = None
class LoadBackendsTest(BaseBackendUtilsTest):
def test_load_backends(self):
loaded_backends = load_backends((
'social.backends.github.GithubOAuth2',
'social.backends.facebook.FacebookOAuth2',
'social.backends.flickr.FlickrOAuth'
), force_load=True)
keys = list(loaded_backends.keys())
keys.sort()
self.assertEqual(keys, ['facebook', 'flickr', 'github'])
backends = ()
loaded_backends = load_backends(backends, force_load=True)
self.assertEqual(len(list(loaded_backends.keys())), 0)
class GetBackendTest(BaseBackendUtilsTest):
def test_get_backend(self):
backend = get_backend((
'social.backends.github.GithubOAuth2',
'social.backends.facebook.FacebookOAuth2',
'social.backends.flickr.FlickrOAuth'
), 'github')
self.assertEqual(backend, GithubOAuth2)
def test_get_missing_backend(self):
with self.assertRaisesRegexp(MissingBackend,
'Missing backend "foobar" entry'):
get_backend(('social.backends.github.GithubOAuth2',
'social.backends.facebook.FacebookOAuth2',
'social.backends.flickr.FlickrOAuth'),
'foobar')
|