mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 08:05:31 +02:00
Remove UnexpectedUpdate exceptions. (#4197)
* Remove UnexpectedUpdate exceptions. These exceptions trigger when the server sends the client back an object with a field that doesn't exactly match what the client previously sent. This causes unnecessary breakage in various cases, doesn't prevent any problems, and isn't required by spec. * Back out all UnexpectedUpdate removals except registration update.
This commit is contained in:
committed by
Brad Warren
parent
26a7023b8d
commit
53117b0ce0
@@ -134,8 +134,6 @@ class Client(object): # pylint: disable=too-many-instance-attributes
|
||||
update = regr.body if update is None else update
|
||||
body = messages.UpdateRegistration(**dict(update))
|
||||
updated_regr = self._send_recv_regr(regr, body=body)
|
||||
if updated_regr != regr:
|
||||
raise errors.UnexpectedUpdate(regr)
|
||||
return updated_regr
|
||||
|
||||
def deactivate_registration(self, regr):
|
||||
@@ -301,7 +299,6 @@ class Client(object): # pylint: disable=too-many-instance-attributes
|
||||
response = self.net.get(authzr.uri)
|
||||
updated_authzr = self._authzr_from_response(
|
||||
response, authzr.body.identifier, authzr.uri, authzr.new_cert_uri)
|
||||
# TODO: check and raise UnexpectedUpdate
|
||||
return updated_authzr, response
|
||||
|
||||
def request_issuance(self, csr, authzrs):
|
||||
|
||||
@@ -121,8 +121,6 @@ class ClientTest(unittest.TestCase):
|
||||
# TODO: split here and separate test
|
||||
self.response.json.return_value = self.regr.body.update(
|
||||
contact=()).to_json()
|
||||
self.assertRaises(
|
||||
errors.UnexpectedUpdate, self.client.update_registration, self.regr)
|
||||
|
||||
def test_deactivate_account(self):
|
||||
self.response.headers['Location'] = self.regr.uri
|
||||
@@ -130,14 +128,6 @@ class ClientTest(unittest.TestCase):
|
||||
self.assertEqual(self.regr,
|
||||
self.client.deactivate_registration(self.regr))
|
||||
|
||||
def test_deactivate_account_bad_registration_returned(self):
|
||||
self.response.headers['Location'] = self.regr.uri
|
||||
self.response.json.return_value = "some wrong registration thing"
|
||||
self.assertRaises(
|
||||
errors.UnexpectedUpdate,
|
||||
self.client.deactivate_registration,
|
||||
self.regr)
|
||||
|
||||
def test_query_registration(self):
|
||||
self.response.json.return_value = self.regr.body.to_json()
|
||||
self.assertEqual(self.regr, self.client.query_registration(self.regr))
|
||||
|
||||
@@ -155,8 +155,6 @@ def perform_registration(acme, config):
|
||||
|
||||
:returns: Registration Resource.
|
||||
:rtype: `acme.messages.RegistrationResource`
|
||||
|
||||
:raises .UnexpectedUpdate:
|
||||
"""
|
||||
try:
|
||||
return acme.register(messages.NewRegistration.from_data(email=config.email))
|
||||
|
||||
Reference in New Issue
Block a user