From 76a66757f308bb081d2bb456a83f9eb2b4c2ed63 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 17 Jul 2008 17:47:29 +0000 Subject: [PATCH] Create a fake auth midleware component for testing --- bluechips/lib/fake_auth.py | 14 ++++++++++++++ setup.py | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 bluechips/lib/fake_auth.py diff --git a/bluechips/lib/fake_auth.py b/bluechips/lib/fake_auth.py new file mode 100644 index 0000000..34dabbb --- /dev/null +++ b/bluechips/lib/fake_auth.py @@ -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) diff --git a/setup.py b/setup.py index 257c70c..0180186 100755 --- 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 """, ) -- 2.45.2