aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathod/test_pathoc.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-02-02 17:23:11 +0100
committerGitHub <noreply@github.com>2017-02-02 17:23:11 +0100
commit3f4d472c80f707b3ffbc060123d811c6bcae2afd (patch)
tree465ed866617e3d613078f1a682ff4eb5018c43f1 /test/pathod/test_pathoc.py
parentc1bc1ea584d4bb47c1b754dfa7f10ab4dfc380a3 (diff)
parent4f0b2bc4dec4eb3c4f0075bcebebeb126a5a6e88 (diff)
downloadmitmproxy-3f4d472c80f707b3ffbc060123d811c6bcae2afd.tar.gz
mitmproxy-3f4d472c80f707b3ffbc060123d811c6bcae2afd.tar.bz2
mitmproxy-3f4d472c80f707b3ffbc060123d811c6bcae2afd.zip
Merge pull request #1980 from Kriechi/improve-tests
improve tests
Diffstat (limited to 'test/pathod/test_pathoc.py')
-rw-r--r--test/pathod/test_pathoc.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py
index 23e0f973..a8f79e67 100644
--- a/test/pathod/test_pathoc.py
+++ b/test/pathod/test_pathoc.py
@@ -78,7 +78,8 @@ class TestDaemonSSL(PathocTestDaemon):
ssl=False,
fp=fp
)
- tutils.raises(NotImplementedError, c.connect)
+ with pytest.raises(NotImplementedError):
+ c.connect()
class TestDaemon(PathocTestDaemon):
@@ -172,12 +173,12 @@ class TestDaemon(PathocTestDaemon):
to = ("foobar", 80)
c = pathoc.Pathoc(("127.0.0.1", self.d.port), fp=None)
c.rfile, c.wfile = io.BytesIO(), io.BytesIO()
- with tutils.raises("connect failed"):
+ with pytest.raises("connect failed"):
c.http_connect(to)
c.rfile = io.BytesIO(
b"HTTP/1.1 500 OK\r\n"
)
- with tutils.raises("connect failed"):
+ with pytest.raises("connect failed"):
c.http_connect(to)
c.rfile = io.BytesIO(
b"HTTP/1.1 200 OK\r\n"
@@ -188,18 +189,21 @@ class TestDaemon(PathocTestDaemon):
to = ("foobar", 80)
c = pathoc.Pathoc(("127.0.0.1", self.d.port), fp=None)
c.rfile, c.wfile = tutils.treader(b""), io.BytesIO()
- tutils.raises(pathoc.PathocError, c.socks_connect, to)
+ with pytest.raises(pathoc.PathocError):
+ c.socks_connect(to)
c.rfile = tutils.treader(
b"\x05\xEE"
)
- tutils.raises("SOCKS without authentication", c.socks_connect, ("example.com", 0xDEAD))
+ with pytest.raises("SOCKS without authentication"):
+ c.socks_connect(("example.com", 0xDEAD))
c.rfile = tutils.treader(
b"\x05\x00" +
b"\x05\xEE\x00\x03\x0bexample.com\xDE\xAD"
)
- tutils.raises("SOCKS server error", c.socks_connect, ("example.com", 0xDEAD))
+ with pytest.raises("SOCKS server error"):
+ c.socks_connect(("example.com", 0xDEAD))
c.rfile = tutils.treader(
b"\x05\x00" +