diff --git a/novaclient/v1_1/security_group_rules.py b/novaclient/v1_1/security_group_rules.py index b2af1a693..fd0bb241a 100644 --- a/novaclient/v1_1/security_group_rules.py +++ b/novaclient/v1_1/security_group_rules.py @@ -54,7 +54,7 @@ class SecurityGroupRuleManager(base.ManagerWithFind): "group_id": group_id, "parent_group_id": parent_group_id }} - return self._create('/security_group_rules', body, "security_group_rule") + return self._create('/os-security-group-rules', body, "security_group_rule") def delete(self, id): """ @@ -64,4 +64,4 @@ class SecurityGroupRuleManager(base.ManagerWithFind): """ if hasattr(id, 'id'): id = id.id - return self._delete('/security_group_rules/%s' % id) + return self._delete('/os-security-group-rules/%s' % id) diff --git a/novaclient/v1_1/security_groups.py b/novaclient/v1_1/security_groups.py index f5e0f8bbb..c0b9a09ca 100644 --- a/novaclient/v1_1/security_groups.py +++ b/novaclient/v1_1/security_groups.py @@ -47,7 +47,7 @@ class SecurityGroupManager(base.ManagerWithFind): :rtype: Integer ID of created security group """ body = {"security_group": {"name": name, 'description': description}} - return self._create('/security_groups', body, 'security_group') + return self._create('/os-security-groups', body, 'security_group') def delete(self, id): """ @@ -58,7 +58,7 @@ class SecurityGroupManager(base.ManagerWithFind): """ if hasattr(id, 'id'): id = id.id - return self._delete('/security_groups/%d' % id) + return self._delete('/os-security-groups/%d' % id) def get(self, id): """ @@ -69,7 +69,7 @@ class SecurityGroupManager(base.ManagerWithFind): """ if hasattr(id, 'id'): id = id.id - return self._get('/security_groups/%s' % id, 'security_group') + return self._get('/os-security-groups/%s' % id, 'security_group') def list(self): """ @@ -77,4 +77,4 @@ class SecurityGroupManager(base.ManagerWithFind): :rtype: list of :class:`SecurityGroup` """ - return self._list("/security_groups", "security_groups") + return self._list("/os-security-groups", "security_groups") diff --git a/tests/v1_1/fakes.py b/tests/v1_1/fakes.py index eaa016d6f..3279f6422 100644 --- a/tests/v1_1/fakes.py +++ b/tests/v1_1/fakes.py @@ -31,7 +31,7 @@ class FakeHTTPClient(base_client.HTTPClient): assert 'body' in kwargs # Call the method - munged_url = url.strip('/').replace('/', '_').replace('.', '_') + munged_url = url.strip('/').replace('/', '_').replace('.', '_').replace('-', '_') callback = "%s_%s" % (method.lower(), munged_url) if not hasattr(self, callback): raise AssertionError('Called unknown API method: %s %s' % (method, @@ -377,43 +377,43 @@ class FakeHTTPClient(base_client.HTTPClient): # # Security Groups # - def get_security_groups(self, **kw): + def get_os_security_groups(self, **kw): return (200, {"security_groups": [ {'id': 1, 'name': 'test', 'description': 'FAKE_SECURITY_GROUP'} ]}) - def get_security_groups_1(self, **kw): + def get_os_security_groups_1(self, **kw): return (200, {"security_group": {'id': 1, 'name': 'test', 'description': 'FAKE_SECURITY_GROUP'} }) - def delete_security_groups_1(self, **kw): + def delete_os_security_groups_1(self, **kw): return (202, None) - def post_security_groups(self, body, **kw): + def post_os_security_groups(self, body, **kw): assert body.keys() == ['security_group'] fakes.assert_has_keys(body['security_group'], required=['name','description']) - r = {'security_group': self.get_security_groups()[1]['security_groups'][0]} + r = {'security_group': self.get_os_security_groups()[1]['security_groups'][0]} return (202, r) # # Security Group Rules # - def get_security_group_rules(self, **kw): + def get_os_security_group_rules(self, **kw): return (200, {"security_group_rules": [ {'id': 1, 'parent_group_id': 1, 'group_id': 2, 'ip_protocol': 'TCP', 'from_port': '22', 'to_port': 22, 'cidr': '10.0.0.0/8'} ]}) - def delete_security_group_rules_1(self, **kw): + def delete_os_security_group_rules_1(self, **kw): return (202, None) - def post_security_group_rules(self, body, **kw): + def post_os_security_group_rules(self, body, **kw): assert body.keys() == ['security_group_rule'] fakes.assert_has_keys(body['security_group_rule'], required=['parent_group_id'], optional=['group_id','ip_protocol','from_port','to_port','cidr']) - r = {'security_group_rule': self.get_security_group_rules()[1]['security_group_rules'][0]} + r = {'security_group_rule': self.get_os_security_group_rules()[1]['security_group_rules'][0]} return (202, r) diff --git a/tests/v1_1/test_security_group_rules.py b/tests/v1_1/test_security_group_rules.py index de045c2d0..b9e9527b6 100644 --- a/tests/v1_1/test_security_group_rules.py +++ b/tests/v1_1/test_security_group_rules.py @@ -10,9 +10,9 @@ cs = fakes.FakeClient() class SecurityGroupRulesTest(utils.TestCase): def test_delete_security_group_rule(self): cs.security_group_rules.delete(1) - cs.assert_called('DELETE', '/security_group_rules/1') + cs.assert_called('DELETE', '/os-security-group-rules/1') def test_create_security_group(self): sg = cs.security_group_rules.create(1) - cs.assert_called('POST', '/security_group_rules') + cs.assert_called('POST', '/os-security-group-rules') self.assertTrue(isinstance(sg, security_group_rules.SecurityGroupRule)) diff --git a/tests/v1_1/test_security_groups.py b/tests/v1_1/test_security_groups.py index 49b93194c..11428c2b8 100644 --- a/tests/v1_1/test_security_groups.py +++ b/tests/v1_1/test_security_groups.py @@ -10,24 +10,24 @@ cs = fakes.FakeClient() class SecurityGroupsTest(utils.TestCase): def test_list_security_groups(self): sgs = cs.security_groups.list() - cs.assert_called('GET', '/security_groups') + cs.assert_called('GET', '/os-security-groups') [self.assertTrue(isinstance(sg, security_groups.SecurityGroup)) for sg in sgs] def test_get_security_groups(self): sg = cs.security_groups.get(1) - cs.assert_called('GET', '/security_groups/1') + cs.assert_called('GET', '/os-security-groups/1') self.assertTrue(isinstance(sg, security_groups.SecurityGroup)) def test_delete_security_group(self): sg = cs.security_groups.list()[0] sg.delete() - cs.assert_called('DELETE', '/security_groups/1') + cs.assert_called('DELETE', '/os-security-groups/1') cs.security_groups.delete(1) - cs.assert_called('DELETE', '/security_groups/1') + cs.assert_called('DELETE', '/os-security-groups/1') cs.security_groups.delete(sg) - cs.assert_called('DELETE', '/security_groups/1') + cs.assert_called('DELETE', '/os-security-groups/1') def test_create_security_group(self): sg = cs.security_groups.create("foo","foo barr") - cs.assert_called('POST', '/security_groups') + cs.assert_called('POST', '/os-security-groups') self.assertTrue(isinstance(sg, security_groups.SecurityGroup))