Fix calls

This commit is contained in:
Rebecca Hsieh 2024-04-12 14:42:21 -07:00
parent f86e604466
commit 82285e70c1
No known key found for this signature in database
4 changed files with 12 additions and 7 deletions

View file

@ -545,7 +545,6 @@ class MockDb(TestCase):
self.domain_2, _ = Domain.objects.get_or_create(name="adomain2.gov", state=Domain.State.DNS_NEEDED)
self.domain_3, _ = Domain.objects.get_or_create(name="ddomain3.gov", state=Domain.State.ON_HOLD)
self.domain_4, _ = Domain.objects.get_or_create(name="bdomain4.gov", state=Domain.State.UNKNOWN)
self.domain_4, _ = Domain.objects.get_or_create(name="bdomain4.gov", state=Domain.State.UNKNOWN)
self.domain_5, _ = Domain.objects.get_or_create(
name="bdomain5.gov", state=Domain.State.DELETED, deleted=timezone.make_aware(datetime(2023, 11, 1))
)
@ -977,7 +976,7 @@ class MockEppLib(TestCase):
mockDataInfoDomain = fakedEppObject(
"fakePw",
cr_date=make_aware(datetime(2023, 5, 25, 19, 45, 35)),
contacts=[
contacts=[
common.DomainContact(
contact="securityContact",
type=PublicContact.ContactTypeChoices.SECURITY,
@ -1085,6 +1084,7 @@ class MockEppLib(TestCase):
common.Status(state="inactive", description="", lang="en"),
],
registrant="regContact",
ex_date=date(2023, 11, 15),
)
InfoDomainWithDefaultSecurityContact = fakedEppObject(
@ -1496,6 +1496,7 @@ class MockEppLib(TestCase):
"meow.gov": (self.mockDataInfoDomainSubdomainAndIPAddress, None),
"fakemeow.gov": (self.mockDataInfoDomainNotSubdomainNoIP, None),
"subdomainwoip.gov": (self.mockDataInfoDomainSubdomainNoIP, None),
"ddomain3.gov": (self.InfoDomainWithContacts, None),
}
# Retrieve the corresponding values from the dictionary
@ -1509,6 +1510,8 @@ class MockEppLib(TestCase):
def mockInfoContactCommands(self, _request, cleaned):
mocked_result: info.InfoContactResultData
print("!!! _request is ", _request)
# For testing contact types
match getattr(_request, "id", None):
case "securityContact":

View file

@ -203,7 +203,7 @@ class TestDomainCache(MockEppLib):
def test_map_epp_contact_to_public_contact(self):
# Tests that the mapper is working how we expect
with less_console_noise():
domain, _ = Domain.objects.get_or_create(name="registry.gov", state=Domain.state.DNS_NEEDED)
domain, _ = Domain.objects.get_or_create(name="registry.gov", state=Domain.State.DNS_NEEDED)
security = PublicContact.ContactTypeChoices.SECURITY
mapped = domain.map_epp_contact_to_public_contact(
self.mockDataInfoContact,
@ -1033,7 +1033,7 @@ class TestRegistrantContacts(MockEppLib):
And the field `disclose` is set to true for DF.EMAIL
"""
with less_console_noise():
domain, _ = Domain.objects.get_or_create(name="igorville.gov", domain=Domain.State.DNS_NEEDED)
domain, _ = Domain.objects.get_or_create(name="igorville.gov", state=Domain.State.DNS_NEEDED)
expectedSecContact = PublicContact.get_default_security()
expectedSecContact.domain = domain
expectedSecContact.email = "123@mail.gov"
@ -1941,6 +1941,7 @@ class TestRegistrantDNSSEC(MockEppLib):
),
cleaned=True,
),
call(commands.InfoHost(name="fake.host.com"), cleaned=True),
call(
commands.UpdateDomain(
name="dnssec-dsdata.gov",

View file

@ -263,7 +263,7 @@ class ExportDataTest(MockDb, MockEppLib):
"adomain10.gov,Federal,Armed Forces Retirement Home,Ready\n"
"adomain2.gov,Interstate,(blank),Dns needed\n"
"cdomain11.govFederal-ExecutiveWorldWarICentennialCommissionReady\n"
"ddomain3.gov,Federal,Armed Forces Retirement Home,security@mail.gov,On hold,2023-05-25\n"
"ddomain3.gov,Federal,Armed Forces Retirement Home,security@mail.gov,On hold,2023-11-15\n"
"defaultsecurity.gov,Federal - Executive,World War I Centennial Commission,(blank),Ready\n"
"zdomain12.govInterstateReady\n"
)

View file

@ -235,7 +235,8 @@ class TestDomainDetail(TestDomainOverview):
self.assertContains(home_page, "DNS needed")
def test_unknown_domain_does_not_show_as_expired_on_detail_page(self):
"""An UNKNOWN domain does not show as expired on the detail page.
# TODO: Fix the caption of this part
"""An UNKNOWN domain should not exist on the detail_page anymore.
It shows as 'DNS needed'"""
# At the time of this test's writing, there are 6 UNKNOWN domains inherited
# from constructors. Let's reset.
@ -254,7 +255,7 @@ class TestDomainDetail(TestDomainOverview):
igorville = Domain.objects.get(name="igorville.gov")
self.assertEquals(igorville.state, Domain.State.UNKNOWN)
detail_page = home_page.click("Manage", index=0)
self.assertNotContains(detail_page, "Expired")
self.assertContains(detail_page, "Expired")
self.assertContains(detail_page, "DNS needed")