What is test_req_get_basic_auth_pw meant to test.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > What is test_req_get_basic_auth_pw meant to test.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    What is test_req_get_basic_auth_pw meant to test.  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-19-06 01:22 PM


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







[ Post a follow-up to this message ]



    Re: What is test_req_get_basic_auth_pw meant to test.  
Jim Gallacher


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-19-06 10: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 (), bu
t
> 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_aut
h
> 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
>
>







[ Post a follow-up to this message ]



    Re: What is test_req_get_basic_auth_pw meant to test.  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-19-06 10: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
> 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:51 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register