mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 16:30:31 +02:00
Registration: drop singular email/phone
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user