|
Home > Archive > Apache Mod-Python > February 2006 > What is test_req_get_basic_auth_pw meant to test.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
What is test_req_get_basic_auth_pw meant to test.
|
|
| Graham Dumpleton 2006-02-19, 8:22 am |
|
On 19/02/2006, at 9:35 AM, Jim Gallacher wrote:
> I just noticed that "write" is declared twice in request_methods
> [] . What's up with that??
>
> src/requestobject.c
> --------------------
>
> static PyMethodDef request_methods[] = {
> ...
> ... line 1075
> {"write", (PyCFunction) req_write, METH_VARARGS},
>
> ...
> ... line 1087
> {"write", (PyCFunction) req_write, METH_VARARGS},
> ...
For my WTF moment, have a look at test_req_get_basic_auth_pw in the
test suite. I guess it is supposed to be test req.get_basic_auth_pw
(), but
that function isn't even mentioned anywhere. Plus the authenhandler
phase
will not even be run since there is no Require directive in the
configuration.
Even if you add the Require directive, it seems to be testing the
mod_auth
module and not the ability to call req.get_basic_auth_pw().
Would it perhaps be better as:
def test_req_get_basic_auth_pw_conf(self):
c = VirtualHost("*",
ServerName("test_req_get_basic_auth_pw"),
DocumentRoot(DOCUMENT_ROOT),
Directory(DOCUMENT_ROOT,
SetHandler("mod_python"),
AuthName("blah"),
AuthType("basic"),
#PythonAuthenHandler
("tests::req_get_basic_auth_pw"),
PythonHandler
("tests::req_get_basic_auth_pw"),
PythonDebug("On")))
return str(c)
def req_get_basic_auth_pw(req):
req.get_basic_auth_pw()
if req.user != "spam":
req.write("test failed")
else:
req.write("test ok")
return apache.OK
Graham
| |
| Jim Gallacher 2006-02-19, 5:45 pm |
| Yes, this test seems to be broken. I'll create a JIRA issue for it.
We need unit tests for the unit tests. 
Jim
> For my WTF moment, have a look at test_req_get_basic_auth_pw in the
> test suite. I guess it is supposed to be test req.get_basic_auth_pw (), but
> that function isn't even mentioned anywhere. Plus the authenhandler phase
> will not even be run since there is no Require directive in the
> configuration.
> Even if you add the Require directive, it seems to be testing the mod_auth
> module and not the ability to call req.get_basic_auth_pw().
>
> Would it perhaps be better as:
>
> def test_req_get_basic_auth_pw_conf(self):
> c = VirtualHost("*",
> ServerName("test_req_get_basic_auth_pw"),
> DocumentRoot(DOCUMENT_ROOT),
> Directory(DOCUMENT_ROOT,
> SetHandler("mod_python"),
> AuthName("blah"),
> AuthType("basic"),
> #PythonAuthenHandler
> ("tests::req_get_basic_auth_pw"),
> PythonHandler
> ("tests::req_get_basic_auth_pw"),
> PythonDebug("On")))
> return str(c)
>
>
> def req_get_basic_auth_pw(req):
>
> req.get_basic_auth_pw()
> if req.user != "spam":
> req.write("test failed")
> else:
> req.write("test ok")
>
> return apache.OK
>
> Graham
>
>
| |
| Graham Dumpleton 2006-02-19, 5:45 pm |
| I already fixed the test and checked it in. :-)
On 20/02/2006, at 5:15 AM, Jim Gallacher wrote:
[vbcol=seagreen]
> Yes, this test seems to be broken. I'll create a JIRA issue for it.
>
> We need unit tests for the unit tests. 
>
> Jim
>
|
|
|
|
|