diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py index 29ee64612..307d2711b 100644 --- a/src/registrar/models/domain.py +++ b/src/registrar/models/domain.py @@ -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])) diff --git a/src/registrar/tests/test_models_domain.py b/src/registrar/tests/test_models_domain.py index d37a41e02..915094e15 100644 --- a/src/registrar/tests/test_models_domain.py +++ b/src/registrar/tests/test_models_domain.py @@ -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