mitmproxy/test/test_authentication.py
Aldo Cortesi 018c229ae4 Start solidifying proxy authentication
- Add a unit test file
- Remove some extraneous methods
- Change the auth API to make the authenticate method take a header object.
2012-12-31 09:15:56 +13:00

19 lines
545 B
Python

from libmproxy import authentication
from netlib import odict
class TestNullProxyAuth:
def test_simple(self):
na = authentication.NullProxyAuth(authentication.PermissivePasswordManager())
assert not na.auth_challenge_headers()
assert na.authenticate("foo")
class TestBasicProxyAuth:
def test_simple(self):
ba = authentication.BasicProxyAuth(authentication.PermissivePasswordManager())
h = odict.ODictCaseless()
assert ba.auth_challenge_headers()
assert not ba.authenticate(h)