mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Error handling on the post for security contact
This commit is contained in:
parent
5fbe72ce5a
commit
0e5978011d
6 changed files with 108 additions and 7 deletions
|
@ -32,6 +32,8 @@ from epplibwrapper import (
|
|||
ErrorCode,
|
||||
)
|
||||
|
||||
from registrar.models.utility.contact_error import ContactError, ContactErrorCodes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -794,6 +796,20 @@ class MockEppLib(TestCase):
|
|||
# use this for when a contact is being updated
|
||||
# sets the second send() to fail
|
||||
raise RegistryError(code=ErrorCode.OBJECT_EXISTS)
|
||||
elif (
|
||||
isinstance(_request, commands.CreateContact)
|
||||
and getattr(_request, "email", None) == "test@failCreate.gov"
|
||||
):
|
||||
# use this for when a contact is being updated
|
||||
# mocks a registry error on creation
|
||||
raise RegistryError(code=None)
|
||||
elif (
|
||||
isinstance(_request, commands.CreateContact)
|
||||
and getattr(_request, "email", None) == "test@contactError.gov"
|
||||
):
|
||||
# use this for when a contact is being updated
|
||||
# mocks a registry error on creation
|
||||
raise ContactError(code=ContactErrorCodes.CONTACT_TYPE_NONE)
|
||||
elif isinstance(_request, commands.CreateHost):
|
||||
return MagicMock(
|
||||
res_data=[self.mockDataHostChange],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue