From 53a2e8e969d7292a4b8a20a3f645be3d845c5c4c Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Sat, 9 Feb 2013 19:54:14 -0800 Subject: 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 --- nova/tests/api/openstack/compute/contrib/test_security_groups.py | 6 ++++++ 1 file changed, 6 insertions(+) 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') -- cgit