Exemple #1
0
 def test_cmd_add_account_timeout_password(self, mock_read_input: Mock, mock_password_input: Mock):
     with self.assertRaises(TimeoutError):
         mock_read_input.side_effect = ['test_account', 'test_user']
         mock_password_input.side_effect = TimeoutError()
         db = Mock()
         db.contains_account.return_value = False
         main.add_account_cmd(db, {})
Exemple #2
0
 def test_cmd_add_account_exists(self, mock_confirm_input: Mock, mock_read_input: Mock):
     mock_confirm_input.return_value = None
     mock_read_input.return_value = 'test_account'
     db = Mock()
     db.contains_account.return_value = True
     main.add_account_cmd(db, {})
     db.add_account.assert_not_called()
Exemple #3
0
 def test_cmd_add_account(self, mock_read_input: Mock, mock_password_input: Mock):
     mock_read_input.side_effect = ['test_account', 'test_user']
     mock_password_input.return_value = 'test_password'
     db = Mock()
     db.contains_account.return_value = False
     main.add_account_cmd(db, {})
     db.add_account.assert_called_once()
     account, user, password = db.add_account.call_args[0]
     self.assertEqual(account, 'test_account')
     self.assertEqual(user, 'test_user')
     self.assertEqual(password, 'test_password')