mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Add test cases for displaying just nameserver and displaying nameserver AND ip
This commit is contained in:
parent
6c26010fe5
commit
5267a1af53
2 changed files with 95 additions and 1 deletions
|
@ -738,6 +738,7 @@ class MockEppLib(TestCase):
|
|||
"ns1.cats-are-superior3.com",
|
||||
],
|
||||
)
|
||||
|
||||
infoDomainNoHost = fakedEppObject(
|
||||
"my-nameserver.gov",
|
||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||
|
@ -804,7 +805,20 @@ class MockEppLib(TestCase):
|
|||
infoDomainHasIP = fakedEppObject(
|
||||
"nameserverwithip.gov",
|
||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||
contacts=[],
|
||||
contacts=[
|
||||
common.DomainContact(
|
||||
contact="securityContact",
|
||||
type=PublicContact.ContactTypeChoices.SECURITY,
|
||||
),
|
||||
common.DomainContact(
|
||||
contact="technicalContact",
|
||||
type=PublicContact.ContactTypeChoices.TECHNICAL,
|
||||
),
|
||||
common.DomainContact(
|
||||
contact="adminContact",
|
||||
type=PublicContact.ContactTypeChoices.ADMINISTRATIVE,
|
||||
),
|
||||
],
|
||||
hosts=[
|
||||
"ns1.nameserverwithip.gov",
|
||||
"ns2.nameserverwithip.gov",
|
||||
|
@ -813,6 +827,29 @@ class MockEppLib(TestCase):
|
|||
addrs=["1.2.3.4", "2.3.4.5"],
|
||||
)
|
||||
|
||||
justNameserver = fakedEppObject(
|
||||
"justnameserver.com",
|
||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||
contacts=[
|
||||
common.DomainContact(
|
||||
contact="securityContact",
|
||||
type=PublicContact.ContactTypeChoices.SECURITY,
|
||||
),
|
||||
common.DomainContact(
|
||||
contact="technicalContact",
|
||||
type=PublicContact.ContactTypeChoices.TECHNICAL,
|
||||
),
|
||||
common.DomainContact(
|
||||
contact="adminContact",
|
||||
type=PublicContact.ContactTypeChoices.ADMINISTRATIVE,
|
||||
),
|
||||
],
|
||||
hosts=[
|
||||
"ns1.justnameserver.com",
|
||||
"ns2.justnameserver.com",
|
||||
],
|
||||
)
|
||||
|
||||
infoDomainCheckHostIPCombo = fakedEppObject(
|
||||
"nameserversubdomain.gov",
|
||||
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||
|
@ -931,6 +968,7 @@ class MockEppLib(TestCase):
|
|||
"threenameserversDomain.gov": (self.infoDomainThreeHosts, None),
|
||||
"defaultsecurity.gov": (self.InfoDomainWithDefaultSecurityContact, None),
|
||||
"defaulttechnical.gov": (self.InfoDomainWithDefaultTechnicalContact, None),
|
||||
"justnameserver.com": (self.justNameserver, None),
|
||||
}
|
||||
|
||||
# Retrieve the corresponding values from the dictionary
|
||||
|
|
|
@ -1071,6 +1071,13 @@ class TestWithDomainPermissions(TestWithUser):
|
|||
def setUp(self):
|
||||
super().setUp()
|
||||
self.domain, _ = Domain.objects.get_or_create(name="igorville.gov")
|
||||
self.domain_with_ip, _ = Domain.objects.get_or_create(
|
||||
name="nameserverwithip.gov"
|
||||
)
|
||||
self.domain_just_nameserver, _ = Domain.objects.get_or_create(
|
||||
name="justnameserver.com"
|
||||
)
|
||||
|
||||
self.domain_dsdata, _ = Domain.objects.get_or_create(name="dnssec-dsdata.gov")
|
||||
self.domain_multdsdata, _ = Domain.objects.get_or_create(
|
||||
name="dnssec-multdsdata.gov"
|
||||
|
@ -1081,9 +1088,11 @@ class TestWithDomainPermissions(TestWithUser):
|
|||
self.domain_dnssec_none, _ = Domain.objects.get_or_create(
|
||||
name="dnssec-none.gov"
|
||||
)
|
||||
|
||||
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain
|
||||
)
|
||||
|
||||
DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain_dsdata
|
||||
)
|
||||
|
@ -1096,9 +1105,17 @@ class TestWithDomainPermissions(TestWithUser):
|
|||
DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain_dnssec_none
|
||||
)
|
||||
DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain_with_ip
|
||||
)
|
||||
DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain_just_nameserver
|
||||
)
|
||||
|
||||
self.role, _ = UserDomainRole.objects.get_or_create(
|
||||
user=self.user, domain=self.domain, role=UserDomainRole.Roles.MANAGER
|
||||
)
|
||||
|
||||
UserDomainRole.objects.get_or_create(
|
||||
user=self.user, domain=self.domain_dsdata, role=UserDomainRole.Roles.MANAGER
|
||||
)
|
||||
|
@ -1117,6 +1134,16 @@ class TestWithDomainPermissions(TestWithUser):
|
|||
domain=self.domain_dnssec_none,
|
||||
role=UserDomainRole.Roles.MANAGER,
|
||||
)
|
||||
UserDomainRole.objects.get_or_create(
|
||||
user=self.user,
|
||||
domain=self.domain_with_ip,
|
||||
role=UserDomainRole.Roles.MANAGER,
|
||||
)
|
||||
UserDomainRole.objects.get_or_create(
|
||||
user=self.user,
|
||||
domain=self.domain_just_nameserver,
|
||||
role=UserDomainRole.Roles.MANAGER,
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
|
@ -1200,6 +1227,35 @@ class TestDomainOverview(TestWithDomainPermissions, WebTest):
|
|||
response = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_domain_see_just_nameserver(self):
|
||||
home_page = self.app.get("/")
|
||||
self.assertContains(home_page, "justnameserver.com")
|
||||
|
||||
# View nameserver on Domain Overview page
|
||||
detail_page = self.app.get(
|
||||
reverse("domain", kwargs={"pk": self.domain_just_nameserver.id})
|
||||
)
|
||||
|
||||
self.assertContains(detail_page, "justnameserver.com")
|
||||
self.assertContains(detail_page, "ns1.justnameserver.com")
|
||||
self.assertContains(detail_page, "ns2.justnameserver.com")
|
||||
|
||||
def test_domain_see_nameserver_and_ip(self):
|
||||
home_page = self.app.get("/")
|
||||
self.assertContains(home_page, "nameserverwithip.gov")
|
||||
|
||||
# View nameserver on Domain Overview page
|
||||
detail_page = self.app.get(
|
||||
reverse("domain", kwargs={"pk": self.domain_with_ip.id})
|
||||
)
|
||||
|
||||
self.assertContains(detail_page, "nameserverwithip.gov")
|
||||
|
||||
self.assertContains(detail_page, "ns1.nameserverwithip.gov")
|
||||
self.assertContains(detail_page, "ns2.nameserverwithip.gov")
|
||||
self.assertContains(detail_page, "ns3.nameserverwithip.gov")
|
||||
self.assertContains(detail_page, "(1.2.3.4, 2.3.4.5)")
|
||||
|
||||
|
||||
class TestDomainUserManagement(TestDomainOverview):
|
||||
def test_domain_user_management(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue