ソースを参照

Enable tests that were disabled because of moto

We're no longer using the missing functionality
https://github.com/spulec/moto/issues/801
Enis Afgan 9 年 前
コミット
91f9f92e9b

+ 1 - 0
test/__init__.py

@@ -26,6 +26,7 @@ discovery. (The test generator will automatically add ``unittest.TestCase``
 as a base class to each combination).
 """
 import cloudbridge
+
 from test.helpers import ProviderTestCaseGenerator
 from test.test_block_store_service import CloudBlockStoreServiceTestCase
 from test.test_cloud_helpers import CloudHelpersTestCase

+ 0 - 4
test/test_block_store_service.py

@@ -1,10 +1,8 @@
 import time
-from unittest import skip
 import uuid
 
 import six
 
-from cloudbridge.cloud.interfaces.services import BlockStoreService
 from cloudbridge.cloud.interfaces import SnapshotState
 from cloudbridge.cloud.interfaces import VolumeState
 from cloudbridge.cloud.interfaces.resources import AttachmentInfo
@@ -96,7 +94,6 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
             "Volume %s should have been deleted but still exists." %
             name)
 
-    @skip("Until Moto supports 'state' for DescribeSubnets filter")
     @helpers.skipIfNoService(['block_store.volumes'])
     def test_attach_detach_volume(self):
         """
@@ -124,7 +121,6 @@ class CloudBlockStoreServiceTestCase(ProviderTestBase):
                     [VolumeState.AVAILABLE],
                     terminal_states=[VolumeState.ERROR, VolumeState.DELETED])
 
-    @skip("Until Moto supports 'state' for DescribeSubnets filter")
     @helpers.skipIfNoService(['block_store.volumes'])
     def test_volume_properties(self):
         """

+ 1 - 5
test/test_compute_service.py

@@ -1,10 +1,8 @@
 import ipaddress
+import uuid
 
 import six
 
-from unittest import skip
-import uuid
-
 from cloudbridge.cloud.interfaces import InvalidConfigurationException
 from cloudbridge.cloud.interfaces import InstanceState
 from cloudbridge.cloud.interfaces.resources import InstanceType
@@ -21,7 +19,6 @@ class CloudComputeServiceTestCase(ProviderTestBase):
             methodName=methodName, provider=provider)
 
     @helpers.skipIfNoService(['compute.instances', 'network'])
-    @skip("Until Moto supports 'state' for DescribeSubnets filter")
     def test_crud_instance(self):
         name = "CBInstCrud-{0}-{1}".format(
             self.provider.name,
@@ -96,7 +93,6 @@ class CloudComputeServiceTestCase(ProviderTestBase):
     @helpers.skipIfNoService(['compute.instances', 'network',
                               'security.security_groups',
                               'security.key_pairs'])
-    @skip("Until Moto supports 'state' for DescribeSubnets filter")
     def test_instance_properties(self):
         name = "CBInstProps-{0}-{1}".format(
             self.provider.name,

+ 8 - 10
test/test_image_service.py

@@ -1,4 +1,3 @@
-from unittest import skip
 import uuid
 
 import six
@@ -17,7 +16,6 @@ class CloudImageServiceTestCase(ProviderTestBase):
 
     @helpers.skipIfNoService(['compute.images', 'network',
                               'compute.instances'])
-    @skip("Until Moto supports 'state' for DescribeSubnets filter")
     def test_create_and_list_image(self):
         """
         Create a new image and check whether that image can be listed.
@@ -53,7 +51,7 @@ class CloudImageServiceTestCase(ProviderTestBase):
                         test_image.description, six.string_types),
                     "Image description must be None or a string")
 
-                # These checks won't work when >50 images are available
+                # This check won't work when >50 images are available
                 # images = self.provider.compute.images.list()
                 # list_images = [image for image in images
                 #                if image.name == name]
@@ -62,13 +60,13 @@ class CloudImageServiceTestCase(ProviderTestBase):
                 #     "List images does not return the expected image %s" %
                 #     name)
 
-                # # check iteration
-                # iter_images = [image for image in self.provider.compute.images
-                #                if image.name == name]
-                # self.assertTrue(
-                #     len(iter_images) == 1,
-                #     "Iter images does not return the expected image %s" %
-                #     name)
+                # check iteration
+                iter_images = [image for image in self.provider.compute.images
+                               if image.name == name]
+                self.assertTrue(
+                    len(iter_images) == 1,
+                    "Iter images does not return the expected image %s" %
+                    name)
 
                 # find image
                 found_images = self.provider.compute.images.find(name=name)

+ 9 - 1
test/test_security_service.py

@@ -1,7 +1,10 @@
 """Test cloudbridge.security modules."""
 import json
+import unittest
 import uuid
 
+from cloudbridge.cloud.interfaces import TestMockHelperMixin
+
 from test.helpers import ProviderTestBase
 import test.helpers as helpers
 
@@ -199,7 +202,7 @@ class CloudSecurityServiceTestCase(ProviderTestBase):
 #                 sort_keys=True)
 #             self.assertTrue(
 #                 sg.to_json() == json_repr,
-#                 "JSON sec group representation {0} does not match expected {1}"
+#                 "JSON SG representation {0} does not match expected {1}"
 #                 .format(sg.to_json(), json_repr))
 
         sgl = self.provider.security.security_groups.list()
@@ -212,6 +215,11 @@ class CloudSecurityServiceTestCase(ProviderTestBase):
     @helpers.skipIfNoService(['security.security_groups'])
     def test_security_group_rule_add_twice(self):
         """Test whether adding the same rule twice succeeds."""
+        if isinstance(self.provider, TestMockHelperMixin):
+            raise unittest.SkipTest(
+                "Mock provider returns InvalidParameterValue: "
+                "Value security_group is invalid for parameter.")
+
         name = 'cbtestsecuritygroupB-{0}'.format(uuid.uuid4())
         net = self.provider.network.create(name=name)
         sg = self.provider.security.security_groups.create(