def test_multiple_accounts_with_same_email(self): user1 = User(username='******') user2 = User(username='******') user1.email = '*****@*****.**' user2.email = '*****@*****.**' self.do_login.when.called_with(after_complete_checks=False)\ .should.throw(AuthException)
def test_already_associated_error(self): self.user = self.user1 self.do_login() self.user = User(username='******', email='*****@*****.**') with self.assertRaisesRegexp(AuthAlreadyAssociated, 'This github account is already in use.'): self.do_login()
def test_user_persists_in_partial_pipeline(self): user = User(username='******') user.email = '*****@*****.**' self.strategy.set_settings({ 'SOCIAL_AUTH_PIPELINE': ('social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.associate_by_email', 'social.tests.pipeline.set_user_from_args') }) redirect = self.do_login(after_complete_checks=False) # Handle the partial pipeline self.strategy.session_set('attribute', 'testing') data = self.strategy.session_pop('partial_pipeline') idx, backend, xargs, xkwargs = self.strategy.partial_from_session(data) self.backend.continue_pipeline(pipeline_index=idx, *xargs, **xkwargs)
def setUp(self): super(AlreadyAssociatedErrorTest, self).setUp() self.user1 = User(username='******', email='*****@*****.**') self.user = None
def setUp(self): super(AssociateActionTest, self).setUp() self.user = User(username='******', email='*****@*****.**') self.backend.strategy.session_set('username', self.user.username)
def test_already_associated_error(self): self.user = self.user1 self.do_login() self.user = User(username='******', email='*****@*****.**') self.do_login.when.called_with().should.throw( AuthAlreadyAssociated, 'This github account is already in use.')
def test_create_social_auth(self): with self.assertRaisesRegexp(NotImplementedError, NOT_IMPLEMENTED_MSG): self.user.create_social_auth(User('foobar'), 1, 'foo')
def test_get_social_auth_for_user(self): with self.assertRaisesRegexp(NotImplementedError, NOT_IMPLEMENTED_MSG): self.user.get_social_auth_for_user(User('foobar'))
def test_get_username(self): with self.assertRaisesRegexp(NotImplementedError, NOT_IMPLEMENTED_MSG): self.user.get_username(User('foobar'))
def test_multiple_accounts_with_same_email(self): user = User(username='******') user.email = '*****@*****.**' self.do_login(after_complete_checks=False) expect(self.strategy.session_get('username').startswith('foobar')) \ .to.equal(True)
def test_random_username(self): User(username='******') self.do_login(after_complete_checks=False) expect(self.strategy.session_get('username').startswith('foobar')) \ .to.equal(True)
def setUp(self): super(AssociateActionTest, self).setUp() self.user = User(username='******', email='*****@*****.**')
def test_create_social_auth(self): self.user.create_social_auth.when \ .called_with(User('foobar'), 1, 'foo') \ .should.throw(NotImplementedError, 'Implement in subclass')
def test_get_social_auth_for_user(self): self.user.get_social_auth_for_user.when.called_with(User('foobar')) \ .should.throw(NotImplementedError, 'Implement in subclass')
def test_get_username(self): self.user.get_username.when.called_with(User('foobar')).should.throw( NotImplementedError, 'Implement in subclass')