Explorar el Código

Fix ip_address unicode issue

Nuwan Goonasekera hace 8 años
padre
commit
b6495902d4
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      test/test_compute_service.py

+ 3 - 1
test/test_compute_service.py

@@ -112,12 +112,14 @@ class CloudComputeServiceTestCase(ProviderTestBase):
             ip_address = test_instance.public_ips[0] \
             ip_address = test_instance.public_ips[0] \
                 if test_instance.public_ips and test_instance.public_ips[0] \
                 if test_instance.public_ips and test_instance.public_ips[0] \
                 else ip_private
                 else ip_private
+            # Convert to unicode for py27 compatibility with ipaddress()
+            ip_address = u"{}".format(ip_address)
             self.assertIsNotNone(
             self.assertIsNotNone(
                 ip_address,
                 ip_address,
                 "Instance must have either a public IP or a private IP")
                 "Instance must have either a public IP or a private IP")
             self.assertTrue(
             self.assertTrue(
                 self._is_valid_ip(ip_address),
                 self._is_valid_ip(ip_address),
-                "Instance must have a valid IP address")
+                "Instance must have a valid IP address. Got: %s" % ip_address)
             self.assertIsInstance(test_instance.vm_type_id,
             self.assertIsInstance(test_instance.vm_type_id,
                                   six.string_types)
                                   six.string_types)
             vm_type = self.provider.compute.vm_types.get(
             vm_type = self.provider.compute.vm_types.get(