Remove extraneous print statements and rename extendedValues to threeNS

This commit is contained in:
Rebecca Hsieh 2023-10-04 09:14:09 -07:00
parent 5fcae0cb80
commit fbad2abd9d
No known key found for this signature in database
GPG key ID: 644527A2F375A379
3 changed files with 9 additions and 10 deletions

View file

@ -277,14 +277,12 @@ class Domain(TimeStampedModel, DomainHelper):
return self.name in nameserver return self.name in nameserver
def checkHostIPCombo(self, nameserver: str, ip: list): def checkHostIPCombo(self, nameserver: str, ip: list):
print("Do I come into checkHostIPCombo")
if self.isSubdomain(nameserver) and (ip is None or ip == []): if self.isSubdomain(nameserver) and (ip is None or ip == []):
raise ValueError( raise ValueError(
"Nameserver %s needs to have an " "Nameserver %s needs to have an "
"IP address because it is a subdomain" % nameserver "IP address because it is a subdomain" % nameserver
) )
elif not self.isSubdomain(nameserver) and (ip is not None and ip != []): elif not self.isSubdomain(nameserver) and (ip is not None and ip != []):
print("In 2nd else statement")
raise ValueError( raise ValueError(
"Nameserver %s cannot be linked " "Nameserver %s cannot be linked "
"because %s is not a subdomain" % (nameserver, ip) "because %s is not a subdomain" % (nameserver, ip)

View file

@ -644,14 +644,15 @@ class MockEppLib(TestCase):
], ],
) )
# TODO-848: Fix naming # Bc we have multiple tests utilizing 3 nameservers,
extendedValues = False # easier to set a flag for it
threeNS = False
def _getattrInfoDomain(self, _request): def _getattrInfoDomain(self, _request):
if getattr(_request, "name", None) == "security.gov": if getattr(_request, "name", None) == "security.gov":
return MagicMock(res_data=[self.infoDomainNoContact]) return MagicMock(res_data=[self.infoDomainNoContact])
elif getattr(_request, "name", None) == "my-nameserver.gov": elif getattr(_request, "name", None) == "my-nameserver.gov":
if self.extendedValues: if self.threeNS:
return MagicMock(res_data=[self.infoDomainThreeHosts]) return MagicMock(res_data=[self.infoDomainThreeHosts])
elif self.mockedSendFunction.call_count == 5: elif self.mockedSendFunction.call_count == 5:
return MagicMock(res_data=[self.infoDomainTwoHosts]) return MagicMock(res_data=[self.infoDomainTwoHosts])

View file

@ -859,7 +859,7 @@ class TestRegistrantNameservers(MockEppLib):
""" """
# Mock is set to return 3 nameservers on infodomain # Mock is set to return 3 nameservers on infodomain
self.extendedValues = True self.threeNS = True
self.domain.nameservers = [(self.nameserver1,), (self.nameserver2,)] self.domain.nameservers = [(self.nameserver1,), (self.nameserver2,)]
expectedCalls = [ expectedCalls = [
# calls info domain, and info on all hosts # calls info domain, and info on all hosts
@ -900,7 +900,7 @@ class TestRegistrantNameservers(MockEppLib):
And `domain.is_active` returns False And `domain.is_active` returns False
""" """
self.extendedValues = True self.threeNS = True
self.domain.ready() self.domain.ready()
self.domain.nameservers = [(self.nameserver1,)] self.domain.nameservers = [(self.nameserver1,)]
expectedCalls = [ expectedCalls = [
@ -952,7 +952,7 @@ class TestRegistrantNameservers(MockEppLib):
And `commands.UpdateDomain` is sent to add #4 and #5 plus remove #2 and #3 And `commands.UpdateDomain` is sent to add #4 and #5 plus remove #2 and #3
And `commands.DeleteHost` is sent to delete #2 and #3 And `commands.DeleteHost` is sent to delete #2 and #3
""" """
self.extendedValues = True self.threeNS = True
self.domain.ready() self.domain.ready()
self.domain.nameservers = [ self.domain.nameservers = [
(self.nameserver1,), (self.nameserver1,),
@ -1112,7 +1112,7 @@ class TestRegistrantNameservers(MockEppLib):
# sent like this, and then implementing appropriate mocks for any errors the # sent like this, and then implementing appropriate mocks for any errors the
# registry normally sends in this case # registry normally sends in this case
self.extendedValues = True self.threeNS = True
# Checking that it doesn't create or update even if out of order # Checking that it doesn't create or update even if out of order
self.domain.nameservers = [ self.domain.nameservers = [
@ -1194,7 +1194,7 @@ class TestRegistrantNameservers(MockEppLib):
# print(self.mockedSendFunction.call_args_list) # print(self.mockedSendFunction.call_args_list)
def tearDown(self): def tearDown(self):
self.extendedValues = False self.threeNS = False
return super().tearDown() return super().tearDown()