]> asedeno.scripts.mit.edu Git - bluechips.git/commitdiff
Create a fake auth midleware component for testing
authorEvan Broder <broder@mit.edu>
Thu, 17 Jul 2008 17:47:29 +0000 (17:47 +0000)
committerEvan Broder <broder@mit.edu>
Thu, 17 Jul 2008 17:47:29 +0000 (17:47 +0000)
bluechips/lib/fake_auth.py [new file with mode: 0644]
setup.py

diff --git a/bluechips/lib/fake_auth.py b/bluechips/lib/fake_auth.py
new file mode 100644 (file)
index 0000000..34dabbb
--- /dev/null
@@ -0,0 +1,14 @@
+"""
+Fake a REMOTE_USER value so that you can do things from the shell and
+run tests.
+"""
+
+class FakeAuth(object):
+    
+    def __init__(self, application, global_conf, username='root'):
+        self.application = application
+        self.username = username
+    
+    def __call__(self, environ, start_response):
+        environ['REMOTE_USER'] = 'root'
+        return self.application(environ, start_response)
index 257c70cab0db4a03aff8b39e5e8c8cd4befd8db5..018018662ec1eae7da795cdabc8a157fb07ae49b 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -33,5 +33,8 @@ setup(
 
     [paste.app_install]
     main = pylons.util:PylonsInstaller
+    
+    [paste.filter_app_factory]
+    fakeauth = bluechips.lib.fake_auth:FakeAuth
     """,
 )