示例#1
0
 def test__create_new_username_credential_succeeds_from_args(
         self, mock_pass):
     test_args = Namespace(**vars(args_to_mock))
     test_args.username = "******"
     test_args.password = "******"
     active_session = Session()
     active_session._update_session_data(test_args)
     auth = active_session._create_new_credential(
         test_args.password, Session.PASSWORD_CRED_TYPE)
示例#2
0
 def test__create_new_username_credential_succeeds_new_password(
         self, mock_pass):
     test_password = "******"
     active_session = Session()
     active_session.username = "******"
     active_session.site = ""
     auth = active_session._create_new_credential(
         test_password, Session.PASSWORD_CRED_TYPE)
     assert auth is not None
示例#3
0
 def test__create_new_username_credential_succeeds_from_self(
         self, mock_pass):
     active_session = Session()
     active_session.username = "******"
     active_session.site = ""
     auth = active_session._create_new_credential(
         None, Session.PASSWORD_CRED_TYPE)
     assert mock_pass.has_been_called()
     assert auth is not None
     assert auth.username == "user3", auth
     assert auth.password == mock_pass(), auth
示例#4
0
 def test__create_new_username_credential_fails_no_args(self, mock_pass):
     active_session = Session()
     with self.assertRaises(SystemExit):
         active_session._create_new_credential(None, None)