added test cases for place and revert client hold; allowed for idempotent updates

This commit is contained in:
David Kennedy 2023-09-22 18:51:49 -04:00
parent 7d9c6d1d76
commit 6483aa87c9
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
5 changed files with 91 additions and 175 deletions

View file

@ -639,9 +639,7 @@ class Domain(TimeStampedModel, DomainHelper):
self._invalidate_cache()
except RegistryError as err:
# if registry error occurs, log the error, and raise it as well
logger.error(
f"registry error placing client hold: {err}"
)
logger.error(f"registry error placing client hold: {err}")
raise (err)
def _remove_client_hold(self):
@ -653,9 +651,7 @@ class Domain(TimeStampedModel, DomainHelper):
self._invalidate_cache()
except RegistryError as err:
# if registry error occurs, log the error, and raise it as well
logger.error(
f"registry error removing client hold: {err}"
)
logger.error(f"registry error removing client hold: {err}")
raise (err)
def _delete_domain(self):
@ -789,7 +785,9 @@ class Domain(TimeStampedModel, DomainHelper):
administrative_contact.domain = self
administrative_contact.save()
@transition(field="state", source=State.READY, target=State.ON_HOLD)
@transition(
field="state", source=[State.READY, State.ON_HOLD], target=State.ON_HOLD
)
def place_client_hold(self):
"""place a clienthold on a domain (no longer should resolve)"""
# TODO - ensure all requirements for client hold are made here
@ -798,7 +796,7 @@ class Domain(TimeStampedModel, DomainHelper):
self._place_client_hold()
# TODO -on the client hold ticket any additional error handling here
@transition(field="state", source=State.ON_HOLD, target=State.READY)
@transition(field="state", source=[State.READY, State.ON_HOLD], target=State.READY)
def revert_client_hold(self):
"""undo a clienthold placed on a domain"""