summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
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: