summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Rosen <arosen@nicira.com>2013-02-09 19:54:14 -0800
committerAaron Rosen <arosen@nicira.com>2013-02-11 15:12:25 -0800
commit53a2e8e969d7292a4b8a20a3f645be3d845c5c4c (patch)
treef3312d3a6fe08a5e1027683127f6646eda1b6fc4
parent20424b987946ee56e39f88aed7fddd35c54d7207 (diff)
test_(dis)associate_by_non_existing_security_group_name missing stub
test_(dis)associate_by_non_existing_security_group_name() is passing because it is not finding the instance which also returns HTTPNotFound not because it cannot find the security group. This patch adds the missing stub so that it it checks for the non existing security group. Fixes bug 1120832 Change-Id: I67a2b82ac329193c2438038719f8c052de8081a3
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_security_groups.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_security_groups.py b/nova/tests/api/openstack/compute/contrib/test_security_groups.py
index 231923e6d..93da30d94 100644
--- a/nova/tests/api/openstack/compute/contrib/test_security_groups.py
+++ b/nova/tests/api/openstack/compute/contrib/test_security_groups.py
@@ -448,6 +448,9 @@ class TestSecurityGroups(test.TestCase):
req, '1')
def test_associate_by_non_existing_security_group_name(self):
+ self.stubs.Set(nova.db, 'instance_get', return_server)
+ self.assertEquals(return_server(None, '1'),
+ nova.db.instance_get(None, '1'))
body = dict(addSecurityGroup=dict(name='non-existing'))
req = fakes.HTTPRequest.blank('/v2/fake/servers/1/action')
@@ -537,6 +540,9 @@ class TestSecurityGroups(test.TestCase):
self.manager._addSecurityGroup(req, '1', body)
def test_disassociate_by_non_existing_security_group_name(self):
+ self.stubs.Set(nova.db, 'instance_get', return_server)
+ self.assertEquals(return_server(None, '1'),
+ nova.db.instance_get(None, '1'))
body = dict(removeSecurityGroup=dict(name='non-existing'))
req = fakes.HTTPRequest.blank('/v2/fake/servers/1/action')