From 68ed333fc0ce55bfe54945a39d7f2a1190b69776 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 14 Oct 2015 21:07:40 -0700 Subject: [PATCH 1/2] Quick fix --- letsencrypt/cli.py | 6 ++++++ letsencrypt/tests/cli_test.py | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 07ccd38fd..92d845538 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -301,6 +301,12 @@ def _auth_from_domains(le_client, config, domains, plugins): raise errors.Error("Certificate could not be obtained") _report_new_cert(lineage.cert) + reporter_util = zope.component.getUtility(interfaces.IReporter) + reporter_util.add_message( + "Your certificate will expire at {0}. To obtain a new version of the " + "certificate in the future, simply run this client again.".format( + lineage.notafter().ctime()), + reporter_util.MEDIUM_PRIORITY) return lineage diff --git a/letsencrypt/tests/cli_test.py b/letsencrypt/tests/cli_test.py index f690e77f9..a3efd9d40 100644 --- a/letsencrypt/tests/cli_test.py +++ b/letsencrypt/tests/cli_test.py @@ -128,8 +128,9 @@ class CLITest(unittest.TestCase): self._auth_new_request_common(mock_client) self.assertEqual( mock_client.obtain_and_enroll_certificate.call_count, 1) - self.assertTrue( - cert_path in mock_get_utility().add_message.call_args[0][0]) + msg = mock_get_utility().add_message.call_args_list[0][0][0] + self.assertTrue(cert_path in msg) + self.assertEqual(mock_get_utility().add_message.call_count, 2) def test_auth_new_request_failure(self): mock_client = mock.MagicMock() @@ -164,8 +165,9 @@ class CLITest(unittest.TestCase): self.assertEqual(mock_lineage.save_successor.call_count, 1) mock_lineage.update_all_links_to.assert_called_once_with( mock_lineage.latest_common_version()) - self.assertTrue( - cert_path in mock_get_utility().add_message.call_args[0][0]) + msg = mock_get_utility().add_message.call_args_list[0][0][0] + self.assertTrue(cert_path in msg) + self.assertEqual(mock_get_utility().add_message.call_count, 2) @mock.patch('letsencrypt.cli.display_ops.pick_installer') @mock.patch('letsencrypt.cli.zope.component.getUtility') From 94622f5edd136c8904a8f7aa0d78a351e4bb2ea2 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 14 Oct 2015 22:53:36 -0700 Subject: [PATCH 2/2] Date only because hard to do time with no time --- letsencrypt/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 92d845538..24f032ca1 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -303,9 +303,9 @@ def _auth_from_domains(le_client, config, domains, plugins): _report_new_cert(lineage.cert) reporter_util = zope.component.getUtility(interfaces.IReporter) reporter_util.add_message( - "Your certificate will expire at {0}. To obtain a new version of the " + "Your certificate will expire on {0}. To obtain a new version of the " "certificate in the future, simply run this client again.".format( - lineage.notafter().ctime()), + lineage.notafter().date()), reporter_util.MEDIUM_PRIORITY) return lineage