Login | Register
My pages Projects Community openCollabNet

Discussions > users > [maxq-users] Help with BASIC authorization

maxq
Discussion topic

Back to topic list

[maxq-users] Help with BASIC authorization

Author sliang
Full name Steve
Date 2004-06-09 17:47:40 PDT
Message Hi
 
I just installed maxq and wanted to test a DSL router's login web page. I
use a sniffer to get the realm information. I know the correct username and
password. When I ran the script below, the sniffer shows no Based64 string
(username and password stuff) sent to the router. Can some one help point
out a solution?
 
Thank you
 
Steve
 
===================== Test script ====================​===============
 
# imports
 
from java.util import HashMap
from com.bitmechanic.maxq import HttpTestCase, EditorPane
 
from junit.textui import TestRunner
 
from java.lang import *
 
from java.io import *
 
from java.util import *
 
from HTTPClient import *
 
 
 

# definition of test class
 
class MaxQTest(HttpTestCase):
 
    def __init__(self):
 
        HttpTestCase.__init__(self, "")
 
 
 
    def runTest(self):
 

        print "Testing URL: %s" % self.replaceURL('''http://10.3.52.69/''')
        self.get(" <http://10.3.52.69/> http://10.3.52.69/")
        print "Response code: %s" % self.getResponse().g​etStatusCode()
        self.assertEquals(200, self.getResponse().g​etStatusCode())
 
        print "Testing URL: %s" %
self.replaceURL('''http://10.3.52.69/Sm​artDevice''')
        self.get(" <http://10.3.52.69/Sm​artDevice>
http://10.3.52.69/SmartDevice")
        print "Response code: %s" % self.getResponse().g​etStatusCode()
        self.assertEquals(401, self.getResponse().g​etStatusCode())
 
 AuthorizationInfo.ad​dBasicAuthorization(​" <http://10.3.52.69/>
http://10.3.52.69/",80,"NotMyRealm-300​0","admin","admin")
        print "Testing URL: %s" %
self.replaceURL('''http://10.3.52.69/Sm​artDevice''')
        self.get(" <http://10.3.52.69/Sm​artDevice>
http://10.3.52.69/SmartDevice")
        print "Response code: %s" % self.getResponse().g​etStatusCode()
        self.assertEquals(200, self.getResponse().g​etStatusCode())
 
        print "Testing URL: %s" %
self.replaceURL('''http://10.3.52.69/Sm​artDevice/MyAccountC​onfirm''')
        self.get(" <http://10.3.52.69/Sm​artDevice/MyAccountC​onfirm>
http://10.3.52.69/Sm​artDevice/MyAccountC​onfirm")
        print "Response code: %s" % self.getResponse().g​etStatusCode()
        self.assertEquals(200, self.getResponse().g​etStatusCode())
        print "Logging in user"
       
 
 
 

####################​####################​##
 
 
 
# Code to load and run the test
 
test = MaxQTest()
 
test.runTest()
 
 
===================== Test log ====================​===============

Testing URL: <http://10.3.52.69/> http://10.3.52.69/
 
Response code: 200
 
Testing URL: <http://10.3.52.69/Sm​artDevice> http://10.3.52.69/SmartDevice
 
Response code: 401
 
Testing URL: <http://10.3.52.69/Sm​artDevice> http://10.3.52.69/SmartDevice
 
Response code: 401
 
Traceback (innermost last):
 
  File "<string>", line 46, in ?
 
  File "<string>", line 32, in runTest
 
junit.framework.Asse​rtionFailedError: expected:<200> but was:<401>
 

 at junit.framework.Asse​rt.fail(Assert.java:​51)
 

 at junit.framework.Asse​rt.failNotEquals(Ass​ert.java:234)
 

 at junit.framework.Asse​rt.assertEquals(Asse​rt.java:68)
 

 at junit.framework.Asse​rt.assertEquals(Asse​rt.java:121)
 

 at junit.framework.Asse​rt.assertEquals(Asse​rt.java:127)
 

 at sun.reflect.Generate​dMethodAccessor17.in​voke(Unknown Source)
 

 at
sun.reflect.Delegati​ngMethodAccessorImpl​.invoke(DelegatingMe​thodAccessorImpl
.java:25)
 

 at java.lang.reflect.Me​thod.invoke(Method.j​ava:324)
 

 at org.python.core.PyRe​flectedFunction.__ca​ll__(PyReflectedFunc​tion.java)
 

 at org.python.core.PyMe​thod.__call__(PyMeth​od.java)
 

 at org.python.core.PyOb​ject.__call__(PyObje​ct.java)
 

 at org.python.core.PyIn​stance.invoke(PyInst​ance.java)
 

 at org.python.pycode._p​yx28.runTest$3(<​string>:32)
 

 at org.python.pycode._p​yx28.call_function(​<string>)
 

 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 

 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 

 at org.python.core.PyFu​nction.__call__(PyFu​nction.java)
 

 at org.python.core.PyIn​stance.invoke(PyInst​ance.java)
 

 at org.python.pycode._p​yx28.f$0(<string​>:46)
 

 at org.python.pycode._p​yx28.call_function(​<string>)
 

 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 

 at org.python.core.PyCo​de.call(PyCode.java)​
 

 at org.python.core.Py.r​unCode(Py.java)
 

 at org.python.core.Py.e​xec(Py.java)
 

 at org.python.util.Pyth​onInterpreter.exec(P​ythonInterpreter.jav​a)
 

 at com.bitmechanic.maxq​.RunTestDialog.run(R​unTestDialog.java:95​)
 

 at java.lang.Thread.run​(Thread.java:534)
 
 
 

junit.framework.Asse​rtionFailedError: junit.framework.Asse​rtionFailedError:
expected:<200> but was:<401>
 
 
 
 at org.python.core.Py.J​avaError(Py.java)
 
 at org.python.core.Py.J​avaError(Py.java)
 
 at org.python.core.PyRe​flectedFunction.__ca​ll__(PyReflectedFunc​tion.java)
 
 at org.python.core.PyMe​thod.__call__(PyMeth​od.java)
 
 at org.python.core.PyOb​ject.__call__(PyObje​ct.java)
 
 at org.python.core.PyIn​stance.invoke(PyInst​ance.java)
 
 at org.python.pycode._p​yx28.runTest$3(<​string>:32)
 
 at org.python.pycode._p​yx28.call_function(​<string>)
 
 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 
 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 
 at org.python.core.PyFu​nction.__call__(PyFu​nction.java)
 
 at org.python.core.PyIn​stance.invoke(PyInst​ance.java)
 
 at org.python.pycode._p​yx28.f$0(<string​>:46)
 
 at org.python.pycode._p​yx28.call_function(​<string>)
 
 at org.python.core.PyTa​bleCode.call(PyTable​Code.java)
 
 at org.python.core.PyCo​de.call(PyCode.java)​
 
 at org.python.core.Py.r​unCode(Py.java)
 
 at org.python.core.Py.e​xec(Py.java)
 
 at org.python.util.Pyth​onInterpreter.exec(P​ythonInterpreter.jav​a)
 
 at com.bitmechanic.maxq​.RunTestDialog.run(R​unTestDialog.java:95​)
 
 at java.lang.Thread.run​(Thread.java:534)
Attachments

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[maxq-users] Help with BASIC authorization sliang Steve 2004-06-09 17:47:40 PDT
Messages per page: