From 1bc9e7cb6471d27fd2b238fcca221d5f3fb361de Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Thu, 9 Jul 2015 06:53:06 +0000 Subject: [PATCH] Registration: drop singular email/phone --- acme/messages.py | 24 ------------------------ acme/messages_test.py | 12 ------------ letsencrypt/account.py | 4 ++-- letsencrypt/tests/account_test.py | 3 ++- 4 files changed, 4 insertions(+), 39 deletions(-) diff --git a/acme/messages.py b/acme/messages.py index 4d82a7723..0749b5f49 100644 --- a/acme/messages.py +++ b/acme/messages.py @@ -180,30 +180,6 @@ class Registration(ResourceBody): """All emails found in the ``contact`` field.""" return self._filter_contact(self.email_prefix) - @property - def phone(self): - """Phone. - - Picks any phone from `phones` or ``None`` if not available. - - """ - try: - return self.phones[0] - except IndexError: - return None - - @property - def email(self): - """Email. - - Picks any email from `emails` or ``None`` if not available. - - """ - try: - return self.emails[0] - except IndexError: - return None - class RegistrationResource(ResourceWithURI): """Registration Resource. diff --git a/acme/messages_test.py b/acme/messages_test.py index 4f99b538d..d028a59c5 100644 --- a/acme/messages_test.py +++ b/acme/messages_test.py @@ -147,18 +147,6 @@ class RegistrationTest(unittest.TestCase): def test_emails(self): self.assertEqual(('admin@foo.com',), self.reg.emails) - def test_phone(self): - self.assertEqual('1234', self.reg.phone) - - def test_phone_none(self): - self.assertTrue(self.reg_none.phone is None) - - def test_email(self): - self.assertEqual('admin@foo.com', self.reg.email) - - def test_email_none(self): - self.assertTrue(self.reg_none.email is None) - def test_to_partial_json(self): self.assertEqual(self.jobj_to, self.reg.to_partial_json()) diff --git a/letsencrypt/account.py b/letsencrypt/account.py index 2f8eaab27..4289a190e 100644 --- a/letsencrypt/account.py +++ b/letsencrypt/account.py @@ -98,9 +98,9 @@ def report_new_account(acc, config): "them using the token \"{0}\". You must write that down " "and put it in a safe place.".format( acc.regr.body.recovery_token)) - if acc.regr.body.email is not None: + if acc.regr.body.emails: recovery_msg += (" Another recovery method will be e-mails sent to " - "{0}.".format(acc.regr.body.email)) + "{0}.".format(", ".join(acc.regr.body.emails))) reporter.add_message(recovery_msg, reporter.HIGH_PRIORITY, True) diff --git a/letsencrypt/tests/account_test.py b/letsencrypt/tests/account_test.py index 174d3614c..8c2464d34 100644 --- a/letsencrypt/tests/account_test.py +++ b/letsencrypt/tests/account_test.py @@ -81,7 +81,8 @@ class ReportNewAccountTest(unittest.TestCase): call_list = mock_zope().add_message.call_args_list self.assertTrue(self.config.config_dir in call_list[0][0][0]) self.assertTrue(self.acc.regr.body.recovery_token in call_list[1][0][0]) - self.assertTrue(self.acc.regr.body.email in call_list[1][0][0]) + self.assertTrue( + ", ".join(self.acc.regr.body.emails) in call_list[1][0][0]) class AccountMemoryStorageTest(unittest.TestCase):