|
|
@@ -98,8 +98,9 @@ class CloudSecurityServiceTestCase(ProviderTestBase):
|
|
|
.format(name))
|
|
|
|
|
|
def cleanup_sg(self, sg, net):
|
|
|
- self.provider.security.security_groups.delete(group_id=sg.id)
|
|
|
- self.provider.network.delete(network_id=net.id)
|
|
|
+ with helpers.cleanup_action(
|
|
|
+ lambda: self.provider.network.delete(network_id=net.id)):
|
|
|
+ self.provider.security.security_groups.delete(group_id=sg.id)
|
|
|
|
|
|
def test_crud_security_group_service(self):
|
|
|
name = 'cbtestsecuritygroupA-{0}'.format(uuid.uuid4())
|
|
|
@@ -185,16 +186,6 @@ class CloudSecurityServiceTestCase(ProviderTestBase):
|
|
|
self.assertFalse(
|
|
|
sg != sg,
|
|
|
"The same security groups should still be equal?")
|
|
|
- json_repr = json.dumps(
|
|
|
- {"description": name, "name": name, "id": sg.id, "rules":
|
|
|
- [{"from_port": 1111, "group": "", "cidr_ip": "0.0.0.0/0",
|
|
|
- "parent": sg.id, "to_port": 1111, "ip_protocol": "tcp",
|
|
|
- "id": sg.rules[0].id}]},
|
|
|
- sort_keys=True)
|
|
|
- self.assertTrue(
|
|
|
- sg.to_json() == json_repr,
|
|
|
- "JSON sec group representation {0} does not match expected {1}"
|
|
|
- .format(sg.to_json(), json_repr))
|
|
|
|
|
|
sgl = self.provider.security.security_groups.list()
|
|
|
found_sg = [g for g in sgl if g.name == name]
|