Add assertion statements and remove cleared todos and some print statements

This commit is contained in:
Rebecca Hsieh 2023-09-25 18:09:25 -07:00
parent 46f6042bf7
commit 07aa476b6a
No known key found for this signature in database
GPG key ID: 644527A2F375A379
2 changed files with 13 additions and 16 deletions

View file

@ -238,10 +238,6 @@ class Domain(TimeStampedModel, DomainHelper):
hostList = []
for host in hosts:
# TODO-848: This should actually have a second tuple value with the ip address
# ignored because uncertain if we will even have a way to display mult.
# and adresses can be a list of mult address
hostList.append((host["name"],host["addrs"]))
return hostList
@ -307,10 +303,8 @@ class Domain(TimeStampedModel, DomainHelper):
oldNameservers=self.nameservers
previousHostDict = self._convert_list_to_dict(oldNameservers)
print("previousHostDict {previousHostDict}")
newHostDict = self._convert_list_to_dict(hosts)
print(f" new host dict {newHostDict}")
deleted_values = []
updated_values = []
new_values = []
@ -323,10 +317,6 @@ class Domain(TimeStampedModel, DomainHelper):
deleted_values.append((prevHost,addrs))
#if the host exists in both, check if the addresses changed
else:
print(f"value in newHostDict[prevHost]{newHostDict[prevHost]}")
print(f"prevhost {prevHost}")
#not right updated_values: [(), (['1.2.4'],)]
if newHostDict[prevHost] != addrs:
updated_values.append((prevHost,newHostDict[prevHost]))

View file

@ -548,17 +548,24 @@ class TestRegistrantNameservers(MockEppLib):
]
newChanges=[("ns1.example.com",),("ns3.example.com",["1.2.4"]),("ns4.example.com",)]
deleted_values,updated_values,new_values, oldNameservers=self.domain.getNameserverChanges(newChanges)
print(f"deleted: {deleted_values}\n")
print(f"updated_values: {updated_values}\n")
print(f"new_values: {new_values}\n")
print(f"oldNameservers: {oldNameservers}\n")
print("CHANGE")
print(self.domain._convert_list_to_dict(newChanges))
# print(f"deleted: {deleted_values}\n")
# print(f"updated_values: {updated_values}\n")
# print(f"new_values: {new_values}\n")
# print(f"oldNameservers: {oldNameservers}\n")
# print("CHANGE")
# print(self.domain._convert_list_to_dict(newChanges))
# Q: This is asserting that 1.2.3 was deleted vs updated -- is this ok or a bug
self.assertEqual(deleted_values, [('ns2.example.com', ['1.2.3'])])
self.assertTrue(updated_values, [('ns3.example.com', ['1.2.4'])])
self.assertTrue(new_values, {'ns4.example.com'})
self.assertTrue(oldNameservers, [('ns1.example.com', None), ('ns2.example.com', ['1.2.3']), ('ns3.example.com', None)])
#expecting:
# updated_values==1 -- which is "ns3.example.com"
# newvalues==1 -- which is "ns4.example.com"
# deleted==1 --which is "ns2.example.com"
def test_user_adds_one_nameserver(self):
"""
Scenario: Registrant adds a single nameserver