Przeglądaj źródła

Fix filter value when listing subnets for a network and add a test

Enis Afgan 8 lat temu
rodzic
commit
e5dc274eb9

+ 1 - 1
cloudbridge/cloud/providers/aws/services.py

@@ -658,7 +658,7 @@ class AWSSubnetService(BaseSubnetService):
         network_id = network.id if isinstance(network, AWSNetwork) else network
         if network_id:
             return self.svc.find(
-                filter_name='VpcId', filter_value=network_id,
+                filter_name='vpc-id', filter_value=network_id,
                 limit=limit, marker=marker)
         else:
             return self.svc.list(limit=limit, marker=marker)

+ 6 - 0
test/test_network_service.py

@@ -55,6 +55,12 @@ class CloudNetworkServiceTestCase(ProviderTestBase):
                     "Subnet ID %s should be listed in network subnets %s."
                     % (sn.id, net.subnets))
 
+                self.assertTrue(
+                    sn in self.provider.networking.subnets.list(network=net),
+                    "Subnet ID %s should be included in the subnets list %s."
+                    % (sn.id, self.provider.networking.subnets.list(net))
+                )
+
                 self.assertListEqual(
                     net.subnets, [sn],
                     "Network should have exactly one subnet: %s." % sn.id)