mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add empty username/pw tests
This commit is contained in:
parent
002f941c7d
commit
ee895f53cf
@ -108,8 +108,11 @@ class TestAuth(BaseTest):
|
||||
server.loop.log.warn = lambda *args, **kwargs: warnings.append(' '.join(args))
|
||||
self.ae((httplib.OK, b'closed'), request())
|
||||
self.ae((httplib.UNAUTHORIZED, b''), request('x', 'y'))
|
||||
self.ae((httplib.BAD_REQUEST, b'The username or password was empty'), request('', ''))
|
||||
self.ae(1, len(warnings))
|
||||
self.ae((httplib.UNAUTHORIZED, b''), request('testuser', 'y'))
|
||||
self.ae((httplib.BAD_REQUEST, b'The username or password was empty'), request('testuser', ''))
|
||||
self.ae((httplib.BAD_REQUEST, b'The username or password was empty'), request(''))
|
||||
self.ae((httplib.UNAUTHORIZED, b''), request('asf', 'testpw'))
|
||||
# }}}
|
||||
|
||||
@ -172,6 +175,9 @@ class TestAuth(BaseTest):
|
||||
# Check that incorrect user/password fails
|
||||
fail_test(conn, lambda da:setattr(da, 'pw', '/'))
|
||||
fail_test(conn, lambda da:setattr(da, 'username', '/'))
|
||||
fail_test(conn, lambda da:setattr(da, 'username', ''))
|
||||
fail_test(conn, lambda da:setattr(da, 'pw', ''))
|
||||
fail_test(conn, lambda da:(setattr(da, 'pw', ''), setattr(da, 'username', '')))
|
||||
|
||||
# Check against python's stdlib
|
||||
self.ae(urlopen(server).read(), b'closed')
|
||||
|
Loading…
x
Reference in New Issue
Block a user