aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_http_auth.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-05-27 11:18:54 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-05-27 11:19:11 +0200
commite3d390e036430b9d7cc4b93679229fe118eb583a (patch)
tree1f10a2a59c8abef4bd24c8189d14602264b20fad /test/test_http_auth.py
parentf7b75ba8c21c66e38da81adf3b2c573b7dae87f3 (diff)
downloadmitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.tar.gz
mitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.tar.bz2
mitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.zip
cleanup code with autopep8
run the following command: $ autopep8 -i -r -a -a .
Diffstat (limited to 'test/test_http_auth.py')
-rw-r--r--test/test_http_auth.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/test_http_auth.py b/test/test_http_auth.py
index 176aa3ff..25df5410 100644
--- a/test/test_http_auth.py
+++ b/test/test_http_auth.py
@@ -1,9 +1,12 @@
-import binascii, cStringIO
+import binascii
+import cStringIO
from netlib import odict, http_auth, http
import mock
import tutils
+
class TestPassManNonAnon:
+
def test_simple(self):
p = http_auth.PassManNonAnon()
assert not p.test("", "")
@@ -11,6 +14,7 @@ class TestPassManNonAnon:
class TestPassManHtpasswd:
+
def test_file_errors(self):
tutils.raises("malformed htpasswd file", http_auth.PassManHtpasswd, tutils.test_data.path("data/server.crt"))
@@ -27,6 +31,7 @@ class TestPassManHtpasswd:
class TestPassManSingleUser:
+
def test_simple(self):
pm = http_auth.PassManSingleUser("test", "test")
assert pm.test("test", "test")
@@ -35,6 +40,7 @@ class TestPassManSingleUser:
class TestNullProxyAuth:
+
def test_simple(self):
na = http_auth.NullProxyAuth(http_auth.PassManNonAnon())
assert not na.auth_challenge_headers()
@@ -43,6 +49,7 @@ class TestNullProxyAuth:
class TestBasicProxyAuth:
+
def test_simple(self):
ba = http_auth.BasicProxyAuth(http_auth.PassManNonAnon(), "test")
h = odict.ODictCaseless()
@@ -60,7 +67,6 @@ class TestBasicProxyAuth:
ba.clean(hdrs)
assert not ba.AUTH_HEADER in hdrs
-
hdrs[ba.AUTH_HEADER] = [""]
assert not ba.authenticate(hdrs)
@@ -77,25 +83,27 @@ class TestBasicProxyAuth:
assert not ba.authenticate(hdrs)
-class Bunch: pass
+class Bunch:
+ pass
class TestAuthAction:
+
def test_nonanonymous(self):
m = Bunch()
aa = http_auth.NonanonymousAuthAction(None, "authenticator")
aa(None, m, None, None)
- assert m.authenticator
+ assert m.authenticator
def test_singleuser(self):
m = Bunch()
aa = http_auth.SingleuserAuthAction(None, "authenticator")
aa(None, m, "foo:bar", None)
- assert m.authenticator
+ assert m.authenticator
tutils.raises("invalid", aa, None, m, "foo", None)
def test_httppasswd(self):
m = Bunch()
aa = http_auth.HtpasswdAuthAction(None, "authenticator")
aa(None, m, tutils.test_data.path("data/htpasswd"), None)
- assert m.authenticator
+ assert m.authenticator