def test_service_not_a_dict(self):
     static_ips = {
         'ControllerIps': None,
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertEqual('The ControllerIps must be a dictionary.', errors[0])
 def test_duplicate_ips_across_services(self):
     static_ips = {
         "ControllerIps": {
             "internal_api": ["10.35.191.60", "10.35.191.70"],
             "storage": ["192.168.100.1", "10.35.191.60", "192.168.100.3"],
         }
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertIn("The 10.35.191.60 IP address was entered multiple times", errors[0])
 def test_duplicate_ips_within_service(self):
     static_ips = {
         'ControllerIps': {
             'internal_api': ['10.35.191.60', '10.35.191.60']
         },
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertIn('The 10.35.191.60 IP address was entered multiple times',
                   errors[0])
 def test_static_ips_not_a_list(self):
     static_ips = {
         'ControllerIps': {
             'internal_api': None,
         }
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertEqual('The ControllerIps->internal_api must be a list.',
                      errors[0])
 def test_duplicate_ips_across_services(self):
     static_ips = {
         'ControllerIps': {
             'internal_api': ['10.35.191.60', '10.35.191.70'],
             'storage': ['192.168.100.1', '10.35.191.60', '192.168.100.3'],
         },
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertIn('The 10.35.191.60 IP address was entered multiple times',
                   errors[0])
 def test_no_duplicate_ips(self):
     static_ips = {
         "ControllerIps": {
             "storage": ["192.168.100.1", "192.168.100.2", "192.168.100.3"],
             "internal_api": ["10.35.191.60", "10.35.191.70"],
         },
         "ComputeIps": {
             "storage": ["192.168.100.125", "192.168.100.135"],
             "internal_api": ["10.35.191.100", "10.35.191.110"],
         },
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual([], errors)
 def test_no_duplicate_ips(self):
     static_ips = {
         'ControllerIps': {
             'storage': ['192.168.100.1', '192.168.100.2', '192.168.100.3'],
             'internal_api': ['10.35.191.60', '10.35.191.70']
         },
         'ComputeIps': {
             'storage': ['192.168.100.125', '192.168.100.135'],
             'internal_api': ['10.35.191.100', '10.35.191.110'],
         }
     }
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual([], errors)
 def test_duplicate_ips_within_service(self):
     static_ips = {"ControllerIps": {"internal_api": ["10.35.191.60", "10.35.191.60"]}}
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertIn("The 10.35.191.60 IP address was entered multiple times", errors[0])
 def test_static_ips_not_a_list(self):
     static_ips = {"ControllerIps": {"internal_api": None}}
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertEqual("The ControllerIps->internal_api must be a list.", errors[0])
 def test_service_not_a_dict(self):
     static_ips = {"ControllerIps": None}
     errors = validation.duplicate_static_ips(static_ips)
     self.assertEqual(len(errors), 1)
     self.assertEqual("The ControllerIps must be a dictionary.", errors[0])
 def test_not_a_dict(self):
     errors = validation.duplicate_static_ips(None)
     self.assertEqual(len(errors), 1)
     self.assertEqual("The static_ips argument must be a dictionary.", errors[0])
 def test_empty(self):
     errors = validation.duplicate_static_ips({})
     self.assertEqual([], errors)
 def test_not_a_dict(self):
     errors = validation.duplicate_static_ips(None)
     self.assertEqual(len(errors), 1)
     self.assertEqual('The static_ips argument must be a dictionary.',
                      errors[0])
 def test_empty(self):
     errors = validation.duplicate_static_ips({})
     self.assertEqual([], errors)