diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-03-31 19:27:26 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2018-04-01 09:46:32 +1200 |
commit | 54170ee6572e8ba38b94a4e51f3c8e832e5f9ac7 (patch) | |
tree | d3599a5d913e8bb37c82718ffe3ccaae46130d1e /test | |
parent | d9752c90f97f6ee7f2283ddafe3cde2553230789 (diff) | |
download | mitmproxy-54170ee6572e8ba38b94a4e51f3c8e832e5f9ac7.tar.gz mitmproxy-54170ee6572e8ba38b94a4e51f3c8e832e5f9ac7.tar.bz2 mitmproxy-54170ee6572e8ba38b94a4e51f3c8e832e5f9ac7.zip |
asyncio: start a test loop for unit tests
Also move signal handling out of master. These only work in the main thread,
and properly belong in main.py.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_fuzzing.py | 12 | ||||
-rw-r--r-- | test/mitmproxy/tservers.py | 2 |
2 files changed, 3 insertions, 11 deletions
diff --git a/test/mitmproxy/test_fuzzing.py b/test/mitmproxy/test_fuzzing.py index 905ba1cd..57d0ca55 100644 --- a/test/mitmproxy/test_fuzzing.py +++ b/test/mitmproxy/test_fuzzing.py @@ -25,14 +25,4 @@ class TestFuzzy(tservers.HTTPProxyTest): p = self.pathoc() with p.connect(): resp = p.request(req % self.server.port) - assert resp.status_code == 400 - - # def test_invalid_upstream(self): - # req = r"get:'http://localhost:%s/p/200:i10,\x27+\x27'" - # p = self.pathoc() - # assert p.request(req % self.server.port).status_code == 502 - - # def test_upstream_disconnect(self): - # req = r'200:d0' - # p = self.pathod(req) - # assert p.status_code == 502 + assert resp.status_code == 400
\ No newline at end of file diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index 7be31a28..9e6cef97 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -4,6 +4,7 @@ import tempfile import sys import time from unittest import mock +import asyncio import mitmproxy.platform from mitmproxy.addons import core @@ -105,6 +106,7 @@ class ProxyThread(threading.Thread): self.tmaster.shutdown() def run(self): + asyncio.set_event_loop(asyncio.new_event_loop()) self.tmaster = self.masterclass(self.options) self.tmaster.addons.add(core.Core()) self.name = "ProxyThread (%s:%s)" % ( |