aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_authentication.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-12-31 09:15:56 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-12-31 09:15:56 +1300
commit018c229ae40d93f0f0987a37a33256db57cdc62c (patch)
tree6a098c71f3af7c8a52b58c342522723ef89ad3c1 /test/test_authentication.py
parentcfab27232127437cca8ac3699065db653da97dba (diff)
downloadmitmproxy-018c229ae40d93f0f0987a37a33256db57cdc62c.tar.gz
mitmproxy-018c229ae40d93f0f0987a37a33256db57cdc62c.tar.bz2
mitmproxy-018c229ae40d93f0f0987a37a33256db57cdc62c.zip
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.
Diffstat (limited to 'test/test_authentication.py')
-rw-r--r--test/test_authentication.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_authentication.py b/test/test_authentication.py
new file mode 100644
index 00000000..25714263
--- /dev/null
+++ b/test/test_authentication.py
@@ -0,0 +1,18 @@
+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)
+