mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 05:26:28 +02:00
Add tests for subdomain and ip logic
This commit is contained in:
parent
88cb4fc78a
commit
d532c389c0
2 changed files with 45 additions and 0 deletions
|
@ -634,6 +634,15 @@ class MockEppLib(TestCase):
|
||||||
],
|
],
|
||||||
addrs=["1.2.3.4", "2.3.4.5"],
|
addrs=["1.2.3.4", "2.3.4.5"],
|
||||||
)
|
)
|
||||||
|
infoDomainCheckHostIPCombo = fakedEppObject(
|
||||||
|
"nameserversubdomain.gov",
|
||||||
|
cr_date=datetime.datetime(2023, 5, 25, 19, 45, 35),
|
||||||
|
contacts=[],
|
||||||
|
hosts=[
|
||||||
|
"ns1.nameserversubdomain.gov",
|
||||||
|
"ns2.nameserversubdomain.gov",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# TODO-848: Fix naming
|
# TODO-848: Fix naming
|
||||||
extendedValues = False
|
extendedValues = False
|
||||||
|
@ -650,6 +659,8 @@ class MockEppLib(TestCase):
|
||||||
return MagicMock(res_data=[self.infoDomainNoHost])
|
return MagicMock(res_data=[self.infoDomainNoHost])
|
||||||
elif getattr(_request, "name", None) == "nameserverwithip.gov":
|
elif getattr(_request, "name", None) == "nameserverwithip.gov":
|
||||||
return MagicMock(res_data=[self.infoDomainHasIP])
|
return MagicMock(res_data=[self.infoDomainHasIP])
|
||||||
|
elif getattr(_request, "name", None) == "namerserversubdomain.gov":
|
||||||
|
return MagicMock(res_data=[self.infoDomainCheckHostIPCombo])
|
||||||
# elif getattr(_request, "name", None) == "failednameserver.gov":
|
# elif getattr(_request, "name", None) == "failednameserver.gov":
|
||||||
# return MagicMock(res_data=[self.infoDomainUpdateFail])
|
# return MagicMock(res_data=[self.infoDomainUpdateFail])
|
||||||
return MagicMock(res_data=[self.mockDataInfoDomain])
|
return MagicMock(res_data=[self.mockDataInfoDomain])
|
||||||
|
|
|
@ -1134,6 +1134,40 @@ class TestRegistrantNameservers(MockEppLib):
|
||||||
self.mockedSendFunction.assert_has_calls(expectedCalls, any_order=True)
|
self.mockedSendFunction.assert_has_calls(expectedCalls, any_order=True)
|
||||||
self.assertEqual(self.mockedSendFunction.call_count, 4)
|
self.assertEqual(self.mockedSendFunction.call_count, 4)
|
||||||
|
|
||||||
|
def test_is_subdomain_with_no_ip(self):
|
||||||
|
domain, _ = Domain.objects.get_or_create(
|
||||||
|
name="nameserversubdomain.gov", state=Domain.State.READY
|
||||||
|
)
|
||||||
|
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
domain.nameservers = [
|
||||||
|
("ns1.nameserversubdomain.gov",),
|
||||||
|
("ns2.nameserversubdomain.gov",),
|
||||||
|
]
|
||||||
|
|
||||||
|
@skip("not implemented yet")
|
||||||
|
def test_not_subdomain_but_has_ip(self):
|
||||||
|
# TO FIX - Logic
|
||||||
|
# domain, _ = Domain.objects.get_or_create(
|
||||||
|
# name="nameserversubdomain.gov", state=Domain.State.READY
|
||||||
|
# )
|
||||||
|
|
||||||
|
# with self.assertRaises(ValueError):
|
||||||
|
# domain.nameservers = [("ns1.cats-da-best.gov", ["1.2.3.4"]),
|
||||||
|
# ("ns2.cats-da-best.gov", ["2.3.4.5"]),]
|
||||||
|
raise
|
||||||
|
|
||||||
|
def test_is_subdomain_but_ip_addr_not_valid(self):
|
||||||
|
domain, _ = Domain.objects.get_or_create(
|
||||||
|
name="nameserversubdomain.gov", state=Domain.State.READY
|
||||||
|
)
|
||||||
|
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
domain.nameservers = [
|
||||||
|
("ns1.nameserversubdomain.gov", ["1.2.3"]),
|
||||||
|
("ns2.nameserversubdomain.gov", ["2.3.4"]),
|
||||||
|
]
|
||||||
|
|
||||||
@skip("not implemented yet")
|
@skip("not implemented yet")
|
||||||
def test_caching_issue(self):
|
def test_caching_issue(self):
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue