mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Update availability API to use EPP availability check
This commit is contained in:
parent
1904c7e461
commit
3ed4c0e4fb
5 changed files with 108 additions and 25 deletions
|
@ -30,6 +30,7 @@ from epplibwrapper import (
|
|||
info,
|
||||
RegistryError,
|
||||
ErrorCode,
|
||||
responses,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -824,7 +825,41 @@ class MockEppLib(TestCase):
|
|||
raise RegistryError(
|
||||
code=ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION
|
||||
)
|
||||
|
||||
elif isinstance(_request, commands.CheckDomain):
|
||||
if "gsa.gov" in getattr(_request, "names", None):
|
||||
return MagicMock(
|
||||
res_data=[
|
||||
responses.check.CheckDomainResultData(
|
||||
name="gsa.gov", avail=True, reason=None
|
||||
),
|
||||
]
|
||||
)
|
||||
elif "GSA.gov" in getattr(_request, "names", None):
|
||||
return MagicMock(
|
||||
res_data=[
|
||||
responses.check.CheckDomainResultData(
|
||||
name="GSA.gov", avail=True, reason=None
|
||||
),
|
||||
]
|
||||
)
|
||||
elif "igorvilleremixed.gov" in getattr(_request, "names", None):
|
||||
return MagicMock(
|
||||
res_data=[
|
||||
responses.check.CheckDomainResultData(
|
||||
name="igorvilleremixed.gov", avail=False, reason=None
|
||||
),
|
||||
]
|
||||
)
|
||||
elif "errordomain.gov" in getattr(_request, "names", None):
|
||||
raise RegistryError("Registry cannot find domain availability.")
|
||||
else:
|
||||
return MagicMock(
|
||||
res_data=[
|
||||
responses.check.CheckDomainResultData(
|
||||
name="domainnotfound.gov", avail=False, reason="In Use"
|
||||
)
|
||||
],
|
||||
)
|
||||
return MagicMock(res_data=[self.mockDataInfoHosts])
|
||||
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue