[kforge-dev] testing authentication with webunit: a subtle bug

Rufus Pollock rufus.pollock at okfn.org
Thu May 11 16:28:06 UTC 2006


I have been working to resolve an authorization bug in kforge 
0.10/0.11.0a (working with 0.10 codebase) which is detailed here:

http://project.knowledgeforge.net/kforge/trac/ticket/8

There is already a webunit test for this issue:

http://project.knowledgeforge.net/kforge/svn/trunk/src/kforge/plugin/davtest.py

Though it was being run from test/deployment.py. So I fixed this up and 
reinstated the test. I was quickly able to identify what I thought was 
the root of the problem and fixed it. However the test still didn't work 
after another half an hour spent testing it by hand (it worked) i traced 
this issue to a bug in the interaction of webunit with our 
authentication scheme:

<pre>
Mod_python error: "PythonAccessHandler 
kforge.handlers.modpython::auth_browser"

Traceback (most recent call last):

   File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/apache.py", 
line 299, in HandlerDispatch
     result = object(req)

   File 
"/Users/kforge/svn-kforge/tags/kforge-0.10/src/kforge/handlers/modpython.py", 
line 47, in auth_browser
     if not isSvnRequest(req):

   File 
"/Users/kforge/svn-kforge/tags/kforge-0.10/src/kforge/handlers/modpython.py", 
line 31, in isSvnRequest
     http_user_agent = req.subprocess_env['HTTP_USER_AGENT']

KeyError: 'HTTP_USER_AGENT'

</pre>

My guess is that it seems that webunit does not insert 'HTTP_USER_AGENT' 
correctly. John: is this something you have already encountered?

Regards,

Rufus

PS: filed at: http://project.knowledgeforge.net/kforge/trac/ticket/9






More information about the kforge-dev mailing list