lint and fix tests

This commit is contained in:
zandercymatics 2025-03-17 14:14:25 -06:00
parent 4c75d4eb14
commit 8d6d06c461
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 20 additions and 8 deletions

View file

@ -107,7 +107,7 @@ class PopulateScriptTemplate(ABC):
verbose: Whether to print a detailed run summary *before* run confirmation. verbose: Whether to print a detailed run summary *before* run confirmation.
Default: False. Default: False.
show_record_count: Whether to show a 'Record 1/10' dialog when running update. show_record_count: Whether to show a 'Record 1/10' dialog when running update.
Default: False. Default: False.

View file

@ -82,7 +82,7 @@ class PublicContact(TimeStampedModel):
if hasattr(self, "domain") and not skip_epp_save: if hasattr(self, "domain") and not skip_epp_save:
self.add_to_domain_in_epp() self.add_to_domain_in_epp()
super().save(*args, **kwargs) super().save(*args, **kwargs)
def add_to_domain_in_epp(self): def add_to_domain_in_epp(self):
"""Adds the current contact to the underlying domain in EPP.""" """Adds the current contact to the underlying domain in EPP."""
match self.contact_type: match self.contact_type:

View file

@ -1910,7 +1910,13 @@ class MockEppLib(TestCase):
return MagicMock(res_data=[mocked_result]) return MagicMock(res_data=[mocked_result])
def mockCreateContactCommands(self, _request, cleaned): def mockCreateContactCommands(self, _request, cleaned):
ids_to_throw_already_exists = ["failAdmin", "failTech", "failSec", "failReg", "fail"] ids_to_throw_already_exists = [
"failAdmin1234567",
"failTech12345678",
"failSec123456789",
"failReg123456789",
"fail",
]
if getattr(_request, "id", None) in ids_to_throw_already_exists and self.mockedSendFunction.call_count == 3: if getattr(_request, "id", None) in ids_to_throw_already_exists and self.mockedSendFunction.call_count == 3:
# use this for when a contact is being updated # use this for when a contact is being updated
# sets the second send() to fail # sets the second send() to fail
@ -1926,7 +1932,13 @@ class MockEppLib(TestCase):
return MagicMock(res_data=[self.mockDataInfoHosts]) return MagicMock(res_data=[self.mockDataInfoHosts])
def mockDeleteContactCommands(self, _request, cleaned): def mockDeleteContactCommands(self, _request, cleaned):
ids_to_throw_already_exists = ["failAdmin", "failTech", "failSec", "failReg", "fail"] ids_to_throw_already_exists = [
"failAdmin1234567",
"failTech12345678",
"failSec123456789",
"failReg123456789",
"fail",
]
if getattr(_request, "id", None) in ids_to_throw_already_exists: if getattr(_request, "id", None) in ids_to_throw_already_exists:
raise RegistryError(code=ErrorCode.OBJECT_EXISTS) raise RegistryError(code=ErrorCode.OBJECT_EXISTS)
else: else:

View file

@ -2525,7 +2525,7 @@ class TestUpdateDefaultPublicContacts(MockEppLib):
# 1. PublicContact with all old default values # 1. PublicContact with all old default values
self.old_default_contact = self.domain.get_default_administrative_contact() self.old_default_contact = self.domain.get_default_administrative_contact()
self.old_default_contact.registry_id = "failAdmin" self.old_default_contact.registry_id = "failAdmin1234567"
self.old_default_contact.name = "CSD/CB ATTN: Cameron Dixon" self.old_default_contact.name = "CSD/CB ATTN: Cameron Dixon"
self.old_default_contact.street1 = "CISA NGR STOP 0645" self.old_default_contact.street1 = "CISA NGR STOP 0645"
self.old_default_contact.pc = "20598-0645" self.old_default_contact.pc = "20598-0645"
@ -2534,7 +2534,7 @@ class TestUpdateDefaultPublicContacts(MockEppLib):
# 2. PublicContact with current default email but old values for other fields # 2. PublicContact with current default email but old values for other fields
self.mixed_default_contact = self.domain.get_default_technical_contact() self.mixed_default_contact = self.domain.get_default_technical_contact()
self.mixed_default_contact.registry_id = "failTech" self.mixed_default_contact.registry_id = "failTech12345678"
self.mixed_default_contact.save(skip_epp_save=True) self.mixed_default_contact.save(skip_epp_save=True)
self.mixed_default_contact.name = "registry customer service" self.mixed_default_contact.name = "registry customer service"
self.mixed_default_contact.street1 = "4200 Wilson Blvd." self.mixed_default_contact.street1 = "4200 Wilson Blvd."
@ -2544,7 +2544,7 @@ class TestUpdateDefaultPublicContacts(MockEppLib):
# 3. PublicContact with non-default values # 3. PublicContact with non-default values
self.non_default_contact = self.domain.get_default_security_contact() self.non_default_contact = self.domain.get_default_security_contact()
self.non_default_contact.registry_id = "failSec" self.non_default_contact.registry_id = "failSec123456789"
self.non_default_contact.domain = self.domain self.non_default_contact.domain = self.domain
self.non_default_contact.save(skip_epp_save=True) self.non_default_contact.save(skip_epp_save=True)
self.non_default_contact.name = "Hotdogs" self.non_default_contact.name = "Hotdogs"
@ -2555,7 +2555,7 @@ class TestUpdateDefaultPublicContacts(MockEppLib):
# 4. Create a default contact but with an old email # 4. Create a default contact but with an old email
self.default_registrant_old_email = self.domain.get_default_registrant_contact() self.default_registrant_old_email = self.domain.get_default_registrant_contact()
self.default_registrant_old_email.registry_id = "failReg" self.default_registrant_old_email.registry_id = "failReg123456789"
self.default_registrant_old_email.email = DefaultEmail.LEGACY_DEFAULT self.default_registrant_old_email.email = DefaultEmail.LEGACY_DEFAULT
self.default_registrant_old_email.save() self.default_registrant_old_email.save()