Renaming security group URL API

- Renaming API to match openstack

Fix bug # 1187181

Change-Id: I00d63c6fb40391de78d4a517fe9ff11e486f75a8
This commit is contained in:
Steve Leon 2013-06-03 18:04:30 -07:00
parent 61008d058d
commit facd76606b
2 changed files with 9 additions and 8 deletions

View File

@ -59,7 +59,8 @@ class SecurityGroups(base.ManagerWithFind):
:rtype: list of :class:`SecurityGroup`. :rtype: list of :class:`SecurityGroup`.
""" """
return self._list("/security_groups", "security_groups", limit, marker) return self._list("/security-groups", "security_groups", limit,
marker)
def get(self, security_group): def get(self, security_group):
""" """
@ -67,7 +68,7 @@ class SecurityGroups(base.ManagerWithFind):
:rtype: :class:`SecurityGroup` :rtype: :class:`SecurityGroup`
""" """
return self._get("/security_groups/%s" % base.getid(security_group), return self._get("/security-groups/%s" % base.getid(security_group),
"security_group") "security_group")
@ -104,16 +105,16 @@ class SecurityGroupRules(base.ManagerWithFind):
"to_port": to_port, "to_port": to_port,
"cidr": cidr "cidr": cidr
}} }}
return self._create("/security_group_rules", body, return self._create("/security-group-rules", body,
"security_group_rule") "security_group_rule")
def delete(self, security_group_rule): def delete(self, security_group_rule):
""" """
Delete the specified security group. Delete the specified security group rule.
:param security_group_id: The security group id to delete :param security_group_rule: The security group rule to delete
""" """
resp, body = self.api.client.delete("/security_group_rules/%s" % resp, body = self.api.client.delete("/security-group-rules/%s" %
base.getid(security_group_rule)) base.getid(security_group_rule))
if resp.status in (422, 500): if resp.status in (422, 500):
raise exceptions.from_response(resp, body) raise exceptions.from_response(resp, body)

View File

@ -38,7 +38,7 @@ class SecGroupTest(TestCase):
self.security_groups._get = Mock(side_effect=side_effect_func) self.security_groups._get = Mock(side_effect=side_effect_func)
self.security_group.id = 1 self.security_group.id = 1
self.assertEqual(('/security_groups/1', 'security_group'), self.assertEqual(('/security-groups/1', 'security_group'),
self.security_groups.get(self.security_group)) self.security_groups.get(self.security_group))
@ -80,7 +80,7 @@ class SecGroupRuleTest(TestCase):
self.security_group_rules._create = Mock(side_effect=side_effect_func) self.security_group_rules._create = Mock(side_effect=side_effect_func)
p, b, i = self.security_group_rules.create(1, "tcp", p, b, i = self.security_group_rules.create(1, "tcp",
80, 80, "0.0.0.0//0") 80, 80, "0.0.0.0//0")
self.assertEqual("/security_group_rules", p) self.assertEqual("/security-group-rules", p)
self.assertEqual("security_group_rule", i) self.assertEqual("security_group_rule", i)
self.assertEqual(1, b["security_group_rule"]["group_id"]) self.assertEqual(1, b["security_group_rule"]["group_id"])
self.assertEqual("tcp", b["security_group_rule"]["protocol"]) self.assertEqual("tcp", b["security_group_rule"]["protocol"])