Fix a commented out portion to fix tests hopefully

This commit is contained in:
Rebecca Hsieh 2025-03-24 17:49:04 -07:00
parent 210d5293d6
commit d072b143ea
No known key found for this signature in database
2 changed files with 19 additions and 22 deletions

View file

@ -2025,22 +2025,6 @@ class Domain(TimeStampedModel, DomainHelper):
data = data_response.res_data[0] data = data_response.res_data[0]
return {
"auth_info": getattr(data, "auth_info", ...),
"_contacts": getattr(data, "contacts", ...),
"cr_date": getattr(data, "cr_date", ...),
"ex_date": getattr(data, "ex_date", ...),
"_hosts": getattr(data, "hosts", ...),
"name": getattr(data, "name", ...),
"registrant": getattr(data, "registrant", ...),
"statuses": [epp.Status(state="pendingDelete", description="", lang="en")],
"tr_date": getattr(data, "tr_date", ...),
"up_date": getattr(data, "up_date", ...),
}
### Original code
# data = data_response.res_data[0]
# return { # return {
# "auth_info": getattr(data, "auth_info", ...), # "auth_info": getattr(data, "auth_info", ...),
# "_contacts": getattr(data, "contacts", ...), # "_contacts": getattr(data, "contacts", ...),
@ -2049,11 +2033,27 @@ class Domain(TimeStampedModel, DomainHelper):
# "_hosts": getattr(data, "hosts", ...), # "_hosts": getattr(data, "hosts", ...),
# "name": getattr(data, "name", ...), # "name": getattr(data, "name", ...),
# "registrant": getattr(data, "registrant", ...), # "registrant": getattr(data, "registrant", ...),
# "statuses": getattr(data, "statuses", ...), # "statuses": [epp.Status(state="pendingDelete", description="", lang="en")],
# "tr_date": getattr(data, "tr_date", ...), # "tr_date": getattr(data, "tr_date", ...),
# "up_date": getattr(data, "up_date", ...), # "up_date": getattr(data, "up_date", ...),
# } # }
## Original code
data = data_response.res_data[0]
return {
"auth_info": getattr(data, "auth_info", ...),
"_contacts": getattr(data, "contacts", ...),
"cr_date": getattr(data, "cr_date", ...),
"ex_date": getattr(data, "ex_date", ...),
"_hosts": getattr(data, "hosts", ...),
"name": getattr(data, "name", ...),
"registrant": getattr(data, "registrant", ...),
"statuses": getattr(data, "statuses", ...),
"tr_date": getattr(data, "tr_date", ...),
"up_date": getattr(data, "up_date", ...),
}
def _clean_cache(self, cache, data_response): def _clean_cache(self, cache, data_response):
"""clean up the cache""" """clean up the cache"""
# remove null properties (to distinguish between "a value of None" and null) # remove null properties (to distinguish between "a value of None" and null)

View file

@ -2271,7 +2271,7 @@ class TestDomainRequestAdmin(MockEppLib):
def test_error_when_approving_domain_in_pending_delete_state(self): def test_error_when_approving_domain_in_pending_delete_state(self):
"""If in pendingDelete state from in review -> approve not allowed.""" """If in pendingDelete state from in review -> approve not allowed."""
# 1. Create domain # 1. Create domain
to_be_in_pending_deleted = completed_domain_request( to_be_in_pending_deleted = completed_domain_request(
status=DomainRequest.DomainRequestStatus.SUBMITTED, name="meoward1.gov" status=DomainRequest.DomainRequestStatus.SUBMITTED, name="meoward1.gov"
) )
@ -2282,9 +2282,7 @@ class TestDomainRequestAdmin(MockEppLib):
to_be_in_pending_deleted.save() to_be_in_pending_deleted.save()
# 3. Update request as a superuser # 3. Update request as a superuser
request = self.factory.post( request = self.factory.post(f"/admin/registrar/domainrequest/{to_be_in_pending_deleted.pk}/change/")
f"/admin/registrar/domainrequest/{to_be_in_pending_deleted.pk}/change/"
)
request.user = self.superuser request.user = self.superuser
request.session = {} request.session = {}
@ -2308,7 +2306,6 @@ class TestDomainRequestAdmin(MockEppLib):
"Domain of same name is currently in pending delete state.", "Domain of same name is currently in pending delete state.",
) )
@less_console_noise @less_console_noise
def test_no_error_when_saving_to_approved_and_domain_exists(self): def test_no_error_when_saving_to_approved_and_domain_exists(self):
"""The negative of the redundant admin check on model transition not allowed.""" """The negative of the redundant admin check on model transition not allowed."""