diff options
Diffstat (limited to 'test.py')
-rwxr-xr-x | test.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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: |