/usr/lib/python2.7/dist-packages/social/tests/actions/test_login.py is in python-social-auth 1:0.2.21+dfsg-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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | from social.tests.models import User
from social.tests.actions.actions import BaseActionTest
class LoginActionTest(BaseActionTest):
def test_login(self):
self.do_login()
def test_login_with_partial_pipeline(self):
self.do_login_with_partial_pipeline()
def test_fields_stored_in_session(self):
self.strategy.set_settings({
'SOCIAL_AUTH_FIELDS_STORED_IN_SESSION': ['foo', 'bar']
})
self.strategy.set_request_data({'foo': '1', 'bar': '2'}, self.backend)
self.do_login()
self.assertEqual(self.strategy.session_get('foo'), '1')
self.assertEqual(self.strategy.session_get('bar'), '2')
def test_redirect_value(self):
self.strategy.set_request_data({'next': '/after-login'}, self.backend)
redirect = self.do_login(after_complete_checks=False)
self.assertEqual(redirect.url, '/after-login')
def test_login_with_invalid_partial_pipeline(self):
def before_complete():
partial = self.strategy.session_get('partial_pipeline')
partial['backend'] = 'foobar'
self.strategy.session_set('partial_pipeline', partial)
self.do_login_with_partial_pipeline(before_complete)
def test_new_user(self):
self.strategy.set_settings({
'SOCIAL_AUTH_NEW_USER_REDIRECT_URL': '/new-user'
})
redirect = self.do_login(after_complete_checks=False)
self.assertEqual(redirect.url, '/new-user')
def test_inactive_user(self):
self.strategy.set_settings({
'SOCIAL_AUTH_INACTIVE_USER_URL': '/inactive'
})
User.set_active(False)
redirect = self.do_login(after_complete_checks=False)
self.assertEqual(redirect.url, '/inactive')
def test_invalid_user(self):
self.strategy.set_settings({
'SOCIAL_AUTH_LOGIN_ERROR_URL': '/error',
'SOCIAL_AUTH_PIPELINE': (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
'social.tests.pipeline.remove_user'
)
})
redirect = self.do_login(after_complete_checks=False)
self.assertEqual(redirect.url, '/error')
|