summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-03-05 10:13:44 -0500
committerRussell Bryant <rbryant@redhat.com>2013-03-05 10:13:44 -0500
commitadbccac10a362d7464bb30f9ae923d0446833a21 (patch)
tree25ac3e004ce13a399b67fc228de1f1777776a0bb /nova/tests
parentc7684046feaaeceedb05d5267d65157086a9761e (diff)
Don't traceback in the API on invalid keypair.
When trying to get a keypair that did not exist, a traceback would end up in the nova-api log. Handle this exception in the API extension so that it doesn't make a mess of the log. Also add a unit test for this particular scenario. Fix bug 1145545. Change-Id: Id1647d4ac56629c2931099320d271e34fc2f99b9
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_keypairs.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_keypairs.py b/nova/tests/api/openstack/compute/contrib/test_keypairs.py
index 06454b123..025845637 100644
--- a/nova/tests/api/openstack/compute/contrib/test_keypairs.py
+++ b/nova/tests/api/openstack/compute/contrib/test_keypairs.py
@@ -236,6 +236,11 @@ class KeypairsTest(test.TestCase):
res = req.get_response(self.app)
self.assertEqual(res.status_int, 202)
+ def test_keypair_get_keypair_not_found(self):
+ req = webob.Request.blank('/v2/fake/os-keypairs/DOESNOTEXIST')
+ res = req.get_response(self.app)
+ self.assertEqual(res.status_int, 404)
+
def test_keypair_delete_not_found(self):
def db_key_pair_get_not_found(context, user_id, name):