mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-31 15:06:32 +02:00
Merge branch 'main' into za/1676-require-investigator-da
This commit is contained in:
commit
6680d7fe17
5 changed files with 252 additions and 18 deletions
|
@ -694,6 +694,56 @@ class MockEppLib(TestCase):
|
|||
],
|
||||
ex_date=datetime.date(2023, 5, 25),
|
||||
)
|
||||
|
||||
mockDataInfoDomainSubdomain = fakedEppObject(
|
||||
"fakePw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 5, 25, 19, 45, 35)),
|
||||
contacts=[common.DomainContact(contact="123", type=PublicContact.ContactTypeChoices.SECURITY)],
|
||||
hosts=["fake.meoward.gov"],
|
||||
statuses=[
|
||||
common.Status(state="serverTransferProhibited", description="", lang="en"),
|
||||
common.Status(state="inactive", description="", lang="en"),
|
||||
],
|
||||
ex_date=datetime.date(2023, 5, 25),
|
||||
)
|
||||
|
||||
mockDataInfoDomainSubdomainAndIPAddress = fakedEppObject(
|
||||
"fakePw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 5, 25, 19, 45, 35)),
|
||||
contacts=[common.DomainContact(contact="123", type=PublicContact.ContactTypeChoices.SECURITY)],
|
||||
hosts=["fake.meow.gov"],
|
||||
statuses=[
|
||||
common.Status(state="serverTransferProhibited", description="", lang="en"),
|
||||
common.Status(state="inactive", description="", lang="en"),
|
||||
],
|
||||
ex_date=datetime.date(2023, 5, 25),
|
||||
addrs=[common.Ip(addr="2.0.0.8")],
|
||||
)
|
||||
|
||||
mockDataInfoDomainNotSubdomainNoIP = fakedEppObject(
|
||||
"fakePw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 5, 25, 19, 45, 35)),
|
||||
contacts=[common.DomainContact(contact="123", type=PublicContact.ContactTypeChoices.SECURITY)],
|
||||
hosts=["fake.meow.com"],
|
||||
statuses=[
|
||||
common.Status(state="serverTransferProhibited", description="", lang="en"),
|
||||
common.Status(state="inactive", description="", lang="en"),
|
||||
],
|
||||
ex_date=datetime.date(2023, 5, 25),
|
||||
)
|
||||
|
||||
mockDataInfoDomainSubdomainNoIP = fakedEppObject(
|
||||
"fakePw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 5, 25, 19, 45, 35)),
|
||||
contacts=[common.DomainContact(contact="123", type=PublicContact.ContactTypeChoices.SECURITY)],
|
||||
hosts=["fake.subdomainwoip.gov"],
|
||||
statuses=[
|
||||
common.Status(state="serverTransferProhibited", description="", lang="en"),
|
||||
common.Status(state="inactive", description="", lang="en"),
|
||||
],
|
||||
ex_date=datetime.date(2023, 5, 25),
|
||||
)
|
||||
|
||||
mockDataExtensionDomain = fakedEppObject(
|
||||
"fakePw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 5, 25, 19, 45, 35)),
|
||||
|
@ -831,6 +881,24 @@ class MockEppLib(TestCase):
|
|||
addrs=[common.Ip(addr="1.2.3.4"), common.Ip(addr="2.3.4.5")],
|
||||
)
|
||||
|
||||
mockDataInfoHosts1IP = fakedEppObject(
|
||||
"lastPw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 8, 25, 19, 45, 35)),
|
||||
addrs=[common.Ip(addr="2.0.0.8")],
|
||||
)
|
||||
|
||||
mockDataInfoHostsNotSubdomainNoIP = fakedEppObject(
|
||||
"lastPw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 8, 26, 19, 45, 35)),
|
||||
addrs=[],
|
||||
)
|
||||
|
||||
mockDataInfoHostsSubdomainNoIP = fakedEppObject(
|
||||
"lastPw",
|
||||
cr_date=make_aware(datetime.datetime(2023, 8, 27, 19, 45, 35)),
|
||||
addrs=[],
|
||||
)
|
||||
|
||||
mockDataHostChange = fakedEppObject("lastPw", cr_date=make_aware(datetime.datetime(2023, 8, 25, 19, 45, 35)))
|
||||
addDsData1 = {
|
||||
"keyTag": 1234,
|
||||
|
@ -997,6 +1065,8 @@ class MockEppLib(TestCase):
|
|||
return self.mockDeleteDomainCommands(_request, cleaned)
|
||||
case commands.RenewDomain:
|
||||
return self.mockRenewDomainCommand(_request, cleaned)
|
||||
case commands.InfoHost:
|
||||
return self.mockInfoHostCommmands(_request, cleaned)
|
||||
case _:
|
||||
return MagicMock(res_data=[self.mockDataInfoHosts])
|
||||
|
||||
|
@ -1011,6 +1081,25 @@ class MockEppLib(TestCase):
|
|||
code=ErrorCode.COMMAND_COMPLETED_SUCCESSFULLY,
|
||||
)
|
||||
|
||||
def mockInfoHostCommmands(self, _request, cleaned):
|
||||
request_name = getattr(_request, "name", None)
|
||||
|
||||
# Define a dictionary to map request names to data and extension values
|
||||
request_mappings = {
|
||||
"fake.meow.gov": (self.mockDataInfoHosts1IP, None), # is subdomain and has ip
|
||||
"fake.meow.com": (self.mockDataInfoHostsNotSubdomainNoIP, None), # not subdomain w no ip
|
||||
"fake.subdomainwoip.gov": (self.mockDataInfoHostsSubdomainNoIP, None), # subdomain w no ip
|
||||
}
|
||||
|
||||
# Retrieve the corresponding values from the dictionary
|
||||
default_mapping = (self.mockDataInfoHosts, None)
|
||||
res_data, extensions = request_mappings.get(request_name, default_mapping)
|
||||
|
||||
return MagicMock(
|
||||
res_data=[res_data],
|
||||
extensions=[extensions] if extensions is not None else [],
|
||||
)
|
||||
|
||||
def mockUpdateHostCommands(self, _request, cleaned):
|
||||
test_ws_ip = common.Ip(addr="1.1. 1.1")
|
||||
addrs_submitted = getattr(_request, "addrs", [])
|
||||
|
@ -1099,6 +1188,10 @@ class MockEppLib(TestCase):
|
|||
"adomain2.gov": (self.InfoDomainWithVerisignSecurityContact, None),
|
||||
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None),
|
||||
"justnameserver.com": (self.justNameserver, None),
|
||||
"meoward.gov": (self.mockDataInfoDomainSubdomain, None),
|
||||
"meow.gov": (self.mockDataInfoDomainSubdomainAndIPAddress, None),
|
||||
"fakemeow.gov": (self.mockDataInfoDomainNotSubdomainNoIP, None),
|
||||
"subdomainwoip.gov": (self.mockDataInfoDomainSubdomainNoIP, None),
|
||||
}
|
||||
|
||||
# Retrieve the corresponding values from the dictionary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue