mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
Reformat + add test case for eppdisclose
This commit is contained in:
parent
e26db14a29
commit
afd7b1c3f3
2 changed files with 69 additions and 2 deletions
|
@ -901,7 +901,7 @@ class MockEppLib(TestCase):
|
||||||
"freeman.gov": (self.InfoDomainWithContacts, None),
|
"freeman.gov": (self.InfoDomainWithContacts, None),
|
||||||
"threenameserversDomain.gov": (self.infoDomainThreeHosts, None),
|
"threenameserversDomain.gov": (self.infoDomainThreeHosts, None),
|
||||||
"defaultsecurity.gov": (self.InfoDomainWithDefaultSecurityContact, None),
|
"defaultsecurity.gov": (self.InfoDomainWithDefaultSecurityContact, None),
|
||||||
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None)
|
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Retrieve the corresponding values from the dictionary
|
# Retrieve the corresponding values from the dictionary
|
||||||
|
|
|
@ -19,7 +19,7 @@ from registrar.utility.errors import ActionNotAllowed, NameserverError
|
||||||
|
|
||||||
from registrar.models.utility.contact_error import ContactError, ContactErrorCodes
|
from registrar.models.utility.contact_error import ContactError, ContactErrorCodes
|
||||||
|
|
||||||
from .common import MockEppLib
|
|
||||||
from django_fsm import TransitionNotAllowed # type: ignore
|
from django_fsm import TransitionNotAllowed # type: ignore
|
||||||
from epplibwrapper import (
|
from epplibwrapper import (
|
||||||
commands,
|
commands,
|
||||||
|
@ -29,6 +29,7 @@ from epplibwrapper import (
|
||||||
RegistryError,
|
RegistryError,
|
||||||
ErrorCode,
|
ErrorCode,
|
||||||
)
|
)
|
||||||
|
from .common import MockEppLib
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -813,6 +814,72 @@ class TestRegistrantContacts(MockEppLib):
|
||||||
# The emails should match on both items
|
# The emails should match on both items
|
||||||
self.assertEqual(expected_contact.email, actual_contact.email)
|
self.assertEqual(expected_contact.email, actual_contact.email)
|
||||||
|
|
||||||
|
def test_convert_public_contact_to_epp(self):
|
||||||
|
self.maxDiff = None
|
||||||
|
domain, _ = Domain.objects.get_or_create(name="freeman.gov")
|
||||||
|
dummy_contact = domain.get_default_security_contact()
|
||||||
|
test_disclose = self._convertPublicContactToEpp(
|
||||||
|
dummy_contact, disclose_email=True
|
||||||
|
).__dict__
|
||||||
|
test_not_disclose = self._convertPublicContactToEpp(
|
||||||
|
dummy_contact, disclose_email=False
|
||||||
|
).__dict__
|
||||||
|
expected_disclose = {
|
||||||
|
"auth_info": common.ContactAuthInfo(pw='2fooBAR123fooBaz'),
|
||||||
|
"disclose": common.Disclose(flag=True, fields={common.DiscloseField.EMAIL}, types=None),
|
||||||
|
"email": "dotgov@cisa.dhs.gov",
|
||||||
|
"extensions": [],
|
||||||
|
"fax": None,
|
||||||
|
"id": "ThIq2NcRIDN7PauO",
|
||||||
|
"ident": None,
|
||||||
|
"notify_email": None,
|
||||||
|
"postal_info": common.PostalInfo(
|
||||||
|
name='Registry Customer Service',
|
||||||
|
addr=common.ContactAddr(
|
||||||
|
street=['4200 Wilson Blvd.', None, None],
|
||||||
|
city='Arlington',
|
||||||
|
pc='22201',
|
||||||
|
cc='US',
|
||||||
|
sp='VA'
|
||||||
|
),
|
||||||
|
org='Cybersecurity and Infrastructure Security Agency',
|
||||||
|
type='loc'
|
||||||
|
),
|
||||||
|
"vat": None,
|
||||||
|
"voice": "+1.8882820870"
|
||||||
|
}
|
||||||
|
expected_not_disclose = {
|
||||||
|
"auth_info": common.ContactAuthInfo(pw='2fooBAR123fooBaz'),
|
||||||
|
"disclose": common.Disclose(flag=False, fields={common.DiscloseField.EMAIL}, types=None),
|
||||||
|
"email": "dotgov@cisa.dhs.gov",
|
||||||
|
"extensions": [],
|
||||||
|
"fax": None,
|
||||||
|
"id": "ThrECENCHI76PGLh",
|
||||||
|
"ident": None,
|
||||||
|
"notify_email": None,
|
||||||
|
"postal_info": common.PostalInfo(
|
||||||
|
name='Registry Customer Service',
|
||||||
|
addr=common.ContactAddr(
|
||||||
|
street=['4200 Wilson Blvd.', None, None],
|
||||||
|
city='Arlington',
|
||||||
|
pc='22201',
|
||||||
|
cc='US',
|
||||||
|
sp='VA'
|
||||||
|
),
|
||||||
|
org='Cybersecurity and Infrastructure Security Agency',
|
||||||
|
type='loc'
|
||||||
|
),
|
||||||
|
"vat": None,
|
||||||
|
"voice": "+1.8882820870"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set the ids equal, since this value changes
|
||||||
|
test_disclose["id"] = expected_disclose["id"]
|
||||||
|
test_not_disclose["id"] = expected_not_disclose["id"]
|
||||||
|
|
||||||
|
self.assertEqual(test_disclose, expected_disclose)
|
||||||
|
self.assertEqual(test_not_disclose, expected_not_disclose)
|
||||||
|
|
||||||
def test_not_disclosed_on_default_security_contact(self):
|
def test_not_disclosed_on_default_security_contact(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Registrant creates a new domain with no security email
|
Scenario: Registrant creates a new domain with no security email
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue