summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2011-11-02 19:24:44 +0100
committerHelmut Grohne <helmut@subdivi.de>2011-11-02 19:24:44 +0100
commit8cebeca5b363b363e101a986d6be089b3429bf08 (patch)
tree96d8a140bbe25fccbb5527e6813e802c9de7c0a0 /test.py
parentc5294defb25246d01c04462ce089a11b1c7c0c2d (diff)
downloadwsgitools-8cebeca5b363b363e101a986d6be089b3429bf08.tar.gz
added digest auth test with qop=auth
Diffstat (limited to 'test.py')
-rwxr-xr-xtest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test.py b/test.py
index c9d972d..3c77c06 100755
--- a/test.py
+++ b/test.py
@@ -218,6 +218,21 @@ class AuthDigestMiddlewareTest(unittest.TestCase):
def test401authfail(self):
self.doauth(password="spam", status=401)
+ def testqopauth(self):
+ res = self.req(self.app)
+ nonce = next(iter(filter(lambda x: x.startswith("nonce="),
+ res.getheader("WWW-Authenticate").split())))
+ nonce = nonce.split('"')[1]
+ req = self.req.copy()
+ token = md5("bar:foo:baz").hexdigest()
+ other = md5("GET:").hexdigest()
+ resp = md5("%s:%s:1:qux:auth:%s" % (token, nonce, other)).hexdigest()
+ req.setheader('http-authorization', 'Digest algorithm=md5,nonce="%s",' \
+ 'uri=,username=bar,response="%s",qop=auth,nc=1,' \
+ 'cnonce=qux' % (nonce, resp))
+ res = req(self.app)
+ res.status(200)
+
from wsgitools import middlewares
class StupidIO: