def test_prompts_bad_email(self, mock_from_email, mock_util): from letsencrypt.account import Account mock_from_email.side_effect = (errors.LetsEncryptClientError, "acc") mock_util().input.return_value = (display_util.OK, self.email) self.assertEqual(Account.from_prompts(self.config), "acc")
def test_prompts_empty_email(self, mock_key, mock_util): from letsencrypt.account import Account mock_util().input.return_value = (display_util.OK, "") acc = Account.from_prompts(self.config) self.assertTrue(acc.email is None) # _get_config_filename | pylint: disable=protected-access mock_key.assert_called_once_with( mock.ANY, mock.ANY, acc._get_config_filename(None))
def test_prompts(self, mock_key, mock_util): from letsencrypt.account import Account mock_util().input.return_value = (display_util.OK, self.email) mock_key.return_value = self.key acc = Account.from_prompts(self.config) self.assertEqual(acc.email, self.email) self.assertEqual(acc.key, self.key) self.assertEqual(acc.config, self.config)
def test_prompts_cancel(self, mock_util): from letsencrypt.account import Account mock_util().input.return_value = (display_util.CANCEL, "") self.assertTrue(Account.from_prompts(self.config) is None)