示例#1
0
    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")
示例#2
0
    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))
示例#3
0
    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)
示例#4
0
    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)