summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Eo <joon.eo@gmail.com>2011-05-09 11:57:33 -0500
committerJohn Eo <joon.eo@gmail.com>2011-05-09 11:57:33 -0500
commitd32af928464afa3d1c6a233efaee3131be784761 (patch)
tree40c5445ace279e3e042f18bd48917f835211dfe7
parent7204593270cd6729baad3665c1d61be56d755d5f (diff)
Adding unit test for the URL extension handler
-rw-r--r--test/unit/test_exthandler.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/unit/test_exthandler.py b/test/unit/test_exthandler.py
new file mode 100644
index 00000000..f7c32fee
--- /dev/null
+++ b/test/unit/test_exthandler.py
@@ -0,0 +1,35 @@
+import os
+import sys
+# Need to access identity module
+sys.path.append(os.path.abspath(os.path.join(
+ os.getcwd(), '..', '..', 'keystone'))
+)
+from queryext.exthandler import UrlExtensionFilter
+import unittest
+
+
+class MockWsgiApp(object):
+
+ def __init__(self):
+ pass
+
+ def __call__(self, env, start_response):
+ pass
+
+
+class UrlExtensionFilterTest(unittest.TestCase):
+
+ def setUp(self):
+ self.filter = UrlExtensionFilter(MockWsgiApp(), {})
+
+ def test_xml_extension(self):
+ def _start_response():
+ pass
+ env = {'PATH_INFO': '/v1.0/someresource.xml'}
+ self.filter(env, _start_response)
+ self.assertEqual('/v1.0/someresource', env['PATH_INFO'])
+ self.assertEqual('application/xml', env['HTTP_ACCEPT'])
+
+
+if __name__ == '__main__':
+ unittest.main()