summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-17 15:54:11 +0000
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-17 15:54:11 +0000
commit25618efd0286bacf4f02abf2529e3411a3dae216 (patch)
treee88a3b2b6ee2438fb0cffdba6d9b14bf40de05c1
parentda09c8fca687d0756cda38c5bd038d677dacd1f3 (diff)
Add a test to ensure invalid extensions don't get added
-rw-r--r--nova/tests/api/openstack/extensions/thirdwheel.py24
-rw-r--r--nova/tests/api/openstack/test_extensions.py7
2 files changed, 31 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/extensions/thirdwheel.py b/nova/tests/api/openstack/extensions/thirdwheel.py
new file mode 100644
index 000000000..c0c56f02c
--- /dev/null
+++ b/nova/tests/api/openstack/extensions/thirdwheel.py
@@ -0,0 +1,24 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+class Thirdwheel(object):
+ def __init__(self):
+ pass
+
+ def get_alias(self):
+ return "THIRD"
diff --git a/nova/tests/api/openstack/test_extensions.py b/nova/tests/api/openstack/test_extensions.py
index 60914c0a3..dd7d9f7b0 100644
--- a/nova/tests/api/openstack/test_extensions.py
+++ b/nova/tests/api/openstack/test_extensions.py
@@ -144,6 +144,13 @@ class ExtensionManagerTest(unittest.TestCase):
self.assertEqual(200, response.status_int)
self.assertEqual(response_body, response.body)
+ def test_invalid_extensions(self):
+ app = openstack.APIRouterV11()
+ ext_midware = extensions.ExtensionMiddleware(app)
+ ext_mgr = ext_midware.ext_mgr
+ self.assertTrue('FOXNSOX' in ext_mgr.extensions)
+ self.assertTrue('THIRD' not in ext_mgr.extensions)
+
class ActionExtensionTest(unittest.TestCase):