aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_authentication.py
diff options
context:
space:
mode:
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)
+