diff options
author | Helmut Grohne <helmut@subdivi.de> | 2011-06-08 10:20:02 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2011-06-08 10:20:02 +0200 |
commit | 19b6693b552b84f92823a26b85abb765c280aed2 (patch) | |
tree | 985504ce23991624842735487efb6f5f1308d437 | |
parent | a0c97b116d5be392310d26c07b499ecc8215e403 (diff) | |
download | wsgitools-19b6693b552b84f92823a26b85abb765c280aed2.tar.gz |
more testcases
-rwxr-xr-x | test.py | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -184,6 +184,20 @@ class AuthDigestMiddlewareTest(unittest.TestCase): res.status(401) res.header("WWW-Authenticate", lambda _: True) + def test401garbage(self): + req = self.req.copy() + req.setheader('http-authorization', 'Garbage') + res = req(self.app) + res.status(401) + res.header("WWW-Authenticate", lambda _: True) + + def test401digestgarbage(self): + req = self.req.copy() + req.setheader('http-authorization', 'Digest ","') + res = req(self.app) + res.status(401) + res.header("WWW-Authenticate", lambda _: True) + def doauth(self, password="baz", status=200): res = self.req(self.app) nonce = next(iter(filter(lambda x: x.startswith("nonce="), @@ -258,6 +272,20 @@ class BasicAuthMiddlewareTest(unittest.TestCase): res.status(401) res.header("WWW-Authenticate", lambda _: True) + def test401garbage(self): + req = self.req.copy() + req.setheader('http-authorization', 'Garbage') + res = req(self.app) + res.status(401) + res.header("WWW-Authenticate", lambda _: True) + + def test401basicgarbage(self): + req = self.req.copy() + req.setheader('http-authorization', 'Basic ()') + res = req(self.app) + res.status(401) + res.header("WWW-Authenticate", lambda _: True) + def doauth(self, password="baz", status=200): req = self.req.copy() token = ("bar:%s" % password).encode("base64").strip() |