This repository has been archived by the owner on Jan 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#935] Authentication using account recovery code
with @tuliocasagrande
- Loading branch information
Sriram Viswanathan
committed
Apr 18, 2017
1 parent
3e0d2b5
commit e8f2fe6
Showing
4 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,17 +68,24 @@ def test_domain_name_is_stripped_before_making_bonafide_srp_auth(self): | |
def test_successful_bonafide_auth_should_return_the_user_authentication_object(self): | ||
auth = Authenticator(self._leap_provider) | ||
mock_bonafide_session = Mock() | ||
mock_srp_auth = Mock() | ||
mock_srp_auth.token = 'some_token' | ||
mock_srp_auth.uuid = 'some_uuid' | ||
mock_bonafide_session.authenticate = Mock(return_value=mock_srp_auth) | ||
with patch('pixelated.authentication.Session', return_value=mock_srp_auth): | ||
mock_bonafide_session.token = 'some_token' | ||
mock_bonafide_session.uuid = 'some_uuid' | ||
|
||
with patch('pixelated.authentication.Session', return_value=mock_bonafide_session): | ||
resulting_auth = yield auth.authenticate('[email protected]', 'password') | ||
self.assertIsInstance(resulting_auth, Authentication) | ||
self.assertEquals('username', resulting_auth.username) | ||
self.assertEquals('some_token', resulting_auth.token) | ||
self.assertEquals('some_uuid', resulting_auth.uuid) | ||
self.assertEquals(mock_srp_auth, auth.bonafide_session) | ||
self.assertEquals(mock_bonafide_session, auth.bonafide_session) | ||
|
||
def test_bonafide_auth_called_with_recovery_as_false(self): | ||
auth = Authenticator(self._leap_provider) | ||
mock_bonafide_session = Mock() | ||
|
||
with patch('pixelated.authentication.Session', return_value=mock_bonafide_session): | ||
auth.authenticate('username', 'password') | ||
mock_bonafide_session.authenticate.assert_called_with(recovery=False) | ||
|
||
def test_username_without_domain_is_not_changed(self): | ||
username_without_domain = 'username' | ||
|