mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Address feedback with test captions and double checks
This commit is contained in:
parent
9ea8a5eae8
commit
01788ce9d6
3 changed files with 9 additions and 2 deletions
|
@ -1686,6 +1686,13 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
logger.error("Error _delete_hosts_if_not_used, code was %s error was %s" % (e.code, e))
|
logger.error("Error _delete_hosts_if_not_used, code was %s error was %s" % (e.code, e))
|
||||||
|
|
||||||
def _fix_unknown_state(self, cleaned):
|
def _fix_unknown_state(self, cleaned):
|
||||||
|
"""
|
||||||
|
_fix_unknown_state: Calls _add_missing_contacts_if_unknown
|
||||||
|
to add contacts in as needed (or return an error). Otherwise
|
||||||
|
if we are able to add contacts and the state is out of UNKNOWN
|
||||||
|
and (and should be into DNS_NEEDED), we double check the
|
||||||
|
current state and # of nameservers and update the state from there
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self._add_missing_contacts_if_unknown(cleaned)
|
self._add_missing_contacts_if_unknown(cleaned)
|
||||||
|
|
||||||
|
@ -1694,7 +1701,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
"%s couldn't _add_missing_contacts_if_unknown, error was %s."
|
"%s couldn't _add_missing_contacts_if_unknown, error was %s."
|
||||||
"Domain will still be in UNKNOWN state." % (self.name, e)
|
"Domain will still be in UNKNOWN state." % (self.name, e)
|
||||||
)
|
)
|
||||||
if len(self.nameservers) >= 2:
|
if len(self.nameservers) >= 2 and (self.state != self.State.READY):
|
||||||
self.ready()
|
self.ready()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|
|
@ -1064,7 +1064,6 @@ class MockEppLib(TestCase):
|
||||||
mockDataSecurityContact = mockDataInfoDomain.dummyInfoContactResultData(
|
mockDataSecurityContact = mockDataInfoDomain.dummyInfoContactResultData(
|
||||||
id="securityContact", email="security@mail.gov", cr_date=datetime(2023, 5, 25, 19, 45, 35), pw="lastPw"
|
id="securityContact", email="security@mail.gov", cr_date=datetime(2023, 5, 25, 19, 45, 35), pw="lastPw"
|
||||||
)
|
)
|
||||||
# print("!! mockDataInfoContact is", mockDataInfoContact)
|
|
||||||
InfoDomainWithContacts = fakedEppObject(
|
InfoDomainWithContacts = fakedEppObject(
|
||||||
"fakePw",
|
"fakePw",
|
||||||
cr_date=make_aware(datetime(2023, 5, 25, 19, 45, 35)),
|
cr_date=make_aware(datetime(2023, 5, 25, 19, 45, 35)),
|
||||||
|
|
|
@ -339,6 +339,7 @@ class TestDomainCache(MockEppLib):
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
domain, _ = Domain.objects.get_or_create(name="defaulttechnical.gov")
|
domain, _ = Domain.objects.get_or_create(name="defaulttechnical.gov")
|
||||||
|
# trigger the getter
|
||||||
_ = domain.nameservers
|
_ = domain.nameservers
|
||||||
self.assertEqual(domain.state, Domain.State.DNS_NEEDED)
|
self.assertEqual(domain.state, Domain.State.DNS_NEEDED)
|
||||||
self.assertEqual(PublicContact.objects.filter(domain=domain.id).count(), 2)
|
self.assertEqual(PublicContact.objects.filter(domain=domain.id).count(), 2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue