mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 02:36:02 +02:00
Test for technical contact on its own
This commit is contained in:
parent
f0acb978b9
commit
b824b6725f
2 changed files with 44 additions and 1 deletions
|
@ -663,6 +663,25 @@ class MockEppLib(TestCase):
|
|||
],
|
||||
)
|
||||
|
||||
InfoDomainWithDefaultTechnicalContact = fakedEppObject(
|
||||
"fakepw",
|
||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||
contacts=[
|
||||
common.DomainContact(
|
||||
contact="defaultTech",
|
||||
type=PublicContact.ContactTypeChoices.TECHNICAL,
|
||||
)
|
||||
],
|
||||
hosts=["fake.host.com"],
|
||||
statuses=[
|
||||
common.Status(state="serverTransferProhibited", description="", lang="en"),
|
||||
common.Status(state="inactive", description="", lang="en"),
|
||||
],
|
||||
)
|
||||
|
||||
mockDefaultTechnicalContact = InfoDomainWithContacts.dummyInfoContactResultData(
|
||||
"defaultTech", "dotgov@cisa.dhs.gov"
|
||||
)
|
||||
mockDefaultSecurityContact = InfoDomainWithContacts.dummyInfoContactResultData(
|
||||
"defaultSec", "dotgov@cisa.dhs.gov"
|
||||
)
|
||||
|
@ -702,6 +721,8 @@ class MockEppLib(TestCase):
|
|||
return MagicMock(res_data=[self.InfoDomainWithContacts])
|
||||
elif getattr(_request, "name", None) == "defaultsecurity.gov":
|
||||
return MagicMock(res_data=[self.InfoDomainWithDefaultSecurityContact])
|
||||
elif getattr(_request, "name", None) == "defaulttechnical.gov":
|
||||
return MagicMock(res_data=[self.InfoDomainWithDefaultTechnicalContact])
|
||||
else:
|
||||
return MagicMock(res_data=[self.mockDataInfoDomain])
|
||||
elif isinstance(_request, commands.InfoContact):
|
||||
|
@ -719,6 +740,8 @@ class MockEppLib(TestCase):
|
|||
mocked_result = self.mockRegistrantContact
|
||||
case "defaultSec":
|
||||
mocked_result = self.mockDefaultSecurityContact
|
||||
case "defaultTech":
|
||||
mocked_result = self.mockDefaultTechnicalContact
|
||||
case _:
|
||||
# Default contact return
|
||||
mocked_result = self.mockDataInfoContact
|
||||
|
|
|
@ -750,7 +750,6 @@ class TestRegistrantContacts(MockEppLib):
|
|||
Then Domain sends `commands.CreateContact` to the registry
|
||||
And the field `disclose` is set to false for DF.EMAIL
|
||||
"""
|
||||
self.maxDiff = None
|
||||
domain, _ = Domain.objects.get_or_create(name="defaultsecurity.gov")
|
||||
expectedSecContact = PublicContact.get_default_security()
|
||||
expectedSecContact.domain = domain
|
||||
|
@ -765,6 +764,27 @@ class TestRegistrantContacts(MockEppLib):
|
|||
# Confirm that we are getting a default email
|
||||
self.assertEqual(domain.security_contact.email, expectedSecContact.email)
|
||||
|
||||
def test_not_disclosed_on_default_technical_contact(self):
|
||||
"""
|
||||
Scenario: Registrant creates a new domain with no technical contact
|
||||
When `domain.technical_contact.email` is equal to the default
|
||||
Then Domain sends `commands.CreateContact` to the registry
|
||||
And the field `disclose` is set to false for DF.EMAIL
|
||||
"""
|
||||
domain, _ = Domain.objects.get_or_create(name="defaulttechnical.gov")
|
||||
expectedTechContact = PublicContact.get_default_technical()
|
||||
expectedTechContact.domain = domain
|
||||
expectedTechContact.registry_id = "defaultTech"
|
||||
domain.technical_contact = expectedTechContact
|
||||
|
||||
expectedCreateCommand = self._convertPublicContactToEpp(
|
||||
expectedTechContact, disclose_email=False
|
||||
)
|
||||
|
||||
self.mockedSendFunction.assert_any_call(expectedCreateCommand, cleaned=True)
|
||||
# Confirm that we are getting a default email
|
||||
self.assertEqual(domain.technical_contact.email, expectedTechContact.email)
|
||||
|
||||
def test_is_disclosed_on_security_contact(self):
|
||||
"""
|
||||
Scenario: Registrant creates a new domain with a security email
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue