aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_http.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-03-03 10:37:28 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-03-03 10:37:28 +1300
commit0acab862a65ef4a1823a1bfb702d8be1e3d7b83d (patch)
tree4dbf39ed4e38c6e752080ac699a57029ae326340 /test/test_http.py
parent97537417f01c17903fb4cebd59991eea57faa5e6 (diff)
downloadmitmproxy-0acab862a65ef4a1823a1bfb702d8be1e3d7b83d.tar.gz
mitmproxy-0acab862a65ef4a1823a1bfb702d8be1e3d7b83d.tar.bz2
mitmproxy-0acab862a65ef4a1823a1bfb702d8be1e3d7b83d.zip
Integrate HTTP auth, test to 100%
Diffstat (limited to 'test/test_http.py')
-rw-r--r--test/test_http.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_http.py b/test/test_http.py
index 666dfdbb..1c89900c 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -1,4 +1,4 @@
-import cStringIO, textwrap
+import cStringIO, textwrap, binascii
from netlib import http, odict
import tutils
@@ -291,3 +291,12 @@ def test_parse_url():
assert not http.parse_url("https://foo:bar")
assert not http.parse_url("https://foo:")
+
+def test_parse_http_basic_auth():
+ vals = ("basic", "foo", "bar")
+ assert http.parse_http_basic_auth(http.assemble_http_basic_auth(*vals)) == vals
+ assert not http.parse_http_basic_auth("")
+ assert not http.parse_http_basic_auth("foo bar")
+ v = "basic " + binascii.b2a_base64("foo")
+ assert not http.parse_http_basic_auth(v)
+