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