mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 13:06:30 +02:00
lint
This commit is contained in:
parent
fa373993bf
commit
7ed916a864
2 changed files with 21 additions and 22 deletions
|
@ -795,28 +795,8 @@ class MockEppLib(TestCase):
|
||||||
return self.mockInfoContactCommands(_request, cleaned)
|
return self.mockInfoContactCommands(_request, cleaned)
|
||||||
elif isinstance(_request, commands.UpdateDomain):
|
elif isinstance(_request, commands.UpdateDomain):
|
||||||
return self.mockUpdateDomainCommands(_request, cleaned)
|
return self.mockUpdateDomainCommands(_request, cleaned)
|
||||||
elif (
|
elif isinstance(_request, commands.CreateContact):
|
||||||
isinstance(_request, commands.CreateContact)
|
return self.mockCreateContactCommands(_request, cleaned)
|
||||||
and getattr(_request, "id", None) == "fail"
|
|
||||||
and self.mockedSendFunction.call_count == 3
|
|
||||||
):
|
|
||||||
# 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):
|
elif isinstance(_request, commands.CreateHost):
|
||||||
return MagicMock(
|
return MagicMock(
|
||||||
res_data=[self.mockDataHostChange],
|
res_data=[self.mockDataHostChange],
|
||||||
|
@ -913,6 +893,24 @@ class MockEppLib(TestCase):
|
||||||
|
|
||||||
return MagicMock(res_data=[mocked_result])
|
return MagicMock(res_data=[mocked_result])
|
||||||
|
|
||||||
|
def mockCreateContactCommands(self, _request, cleaned):
|
||||||
|
if (
|
||||||
|
getattr(_request, "id", None) == "fail"
|
||||||
|
and self.mockedSendFunction.call_count == 3
|
||||||
|
):
|
||||||
|
# use this for when a contact is being updated
|
||||||
|
# sets the second send() to fail
|
||||||
|
raise RegistryError(code=ErrorCode.OBJECT_EXISTS)
|
||||||
|
elif 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 getattr(_request, "email", None) == "test@contactError.gov":
|
||||||
|
# use this for when a contact is being updated
|
||||||
|
# mocks a contact error on creation
|
||||||
|
raise ContactError(code=ContactErrorCodes.CONTACT_TYPE_NONE)
|
||||||
|
return MagicMock(res_data=[self.mockDataInfoHosts])
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""mock epp send function as this will fail locally"""
|
"""mock epp send function as this will fail locally"""
|
||||||
self.mockSendPatch = patch("registrar.models.domain.registry.send")
|
self.mockSendPatch = patch("registrar.models.domain.registry.send")
|
||||||
|
|
|
@ -1626,6 +1626,7 @@ class TestDomainSecurityEmail(TestDomainOverview):
|
||||||
response = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
response = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
|
|
||||||
class TestDomainDNSSEC(TestDomainOverview):
|
class TestDomainDNSSEC(TestDomainOverview):
|
||||||
|
|
||||||
"""MockEPPLib is already inherited."""
|
"""MockEPPLib is already inherited."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue