mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
improve tests
This commit is contained in:
parent
90c425bd14
commit
a35a377cbb
Binary file not shown.
@ -26,20 +26,20 @@ def run_tests(src, test, fail):
|
||||
|
||||
if e == 0:
|
||||
if fail:
|
||||
print("SUCCESS but should have FAILED:", src, "Please remove this file from setup.cfg tool:individual_coverage/exclude.")
|
||||
print("UNEXPECTED SUCCESS:", src, "Please remove this file from setup.cfg tool:individual_coverage/exclude.")
|
||||
e = 42
|
||||
else:
|
||||
print("SUCCESS:", src)
|
||||
print("SUCCESS: ", src)
|
||||
else:
|
||||
if fail:
|
||||
print("Ignoring fail:", src)
|
||||
print("IGNORING FAIL: ", src)
|
||||
e = 0
|
||||
else:
|
||||
cov = [l for l in stdout.getvalue().split("\n") if (src in l) or ("was never imported" in l)]
|
||||
if len(cov) == 1:
|
||||
print("FAIL:", cov[0])
|
||||
print("FAIL: ", cov[0])
|
||||
else:
|
||||
print("FAIL:", src, test, stdout.getvalue(), stdout.getvalue())
|
||||
print("FAIL: ", src, test, stdout.getvalue(), stdout.getvalue())
|
||||
print(stderr.getvalue())
|
||||
print(stdout.getvalue())
|
||||
|
||||
|
0
test/mitmproxy/addons/onboardingapp/__init__.py
Normal file
0
test/mitmproxy/addons/onboardingapp/__init__.py
Normal file
@ -1,5 +0,0 @@
|
||||
from mitmproxy import addons
|
||||
|
||||
|
||||
def test_defaults():
|
||||
assert addons.default_addons()
|
@ -1 +0,0 @@
|
||||
# These are actually tests!
|
0
test/mitmproxy/platform/__init__.py
Normal file
0
test/mitmproxy/platform/__init__.py
Normal file
@ -11,7 +11,7 @@ from mitmproxy import options
|
||||
from mitmproxy.proxy.config import ProxyConfig
|
||||
|
||||
import mitmproxy.net
|
||||
from ....mitmproxy.net import tservers as net_tservers
|
||||
from ...net import tservers as net_tservers
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy.net.http import http1, http2
|
||||
|
||||
|
@ -11,7 +11,7 @@ from mitmproxy.proxy.config import ProxyConfig
|
||||
|
||||
from mitmproxy.net import tcp
|
||||
from mitmproxy.net import http
|
||||
from ....mitmproxy.net import tservers as net_tservers
|
||||
from ...net import tservers as net_tservers
|
||||
from ... import tservers
|
||||
|
||||
from mitmproxy.net import websockets
|
||||
|
@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from mitmproxy import addons
|
||||
from mitmproxy import addonmanager
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy import options
|
||||
@ -76,6 +77,10 @@ def test_lifecycle():
|
||||
a.configure_all(o, o.keys())
|
||||
|
||||
|
||||
def test_defaults():
|
||||
assert addons.default_addons()
|
||||
|
||||
|
||||
def test_simple():
|
||||
o = options.Options()
|
||||
m = master.Master(o, proxy.DummyServer(o))
|
||||
|
@ -3,7 +3,6 @@ from unittest import mock
|
||||
from OpenSSL import SSL
|
||||
import pytest
|
||||
|
||||
|
||||
from mitmproxy.tools import cmdline
|
||||
from mitmproxy.tools import main
|
||||
from mitmproxy import options
|
||||
|
@ -1,10 +1,10 @@
|
||||
import os
|
||||
from os.path import normpath
|
||||
from unittest import mock
|
||||
|
||||
from mitmproxy.tools.console import pathedit
|
||||
from mitmproxy.test import tutils
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestPathCompleter:
|
||||
|
||||
@ -56,8 +56,8 @@ class TestPathEdit:
|
||||
|
||||
pe = pathedit.PathEdit("", "")
|
||||
|
||||
with patch('urwid.widget.Edit.get_edit_text') as get_text, \
|
||||
patch('urwid.widget.Edit.set_edit_text') as set_text:
|
||||
with mock.patch('urwid.widget.Edit.get_edit_text') as get_text, \
|
||||
mock.patch('urwid.widget.Edit.set_edit_text') as set_text:
|
||||
|
||||
cd = os.path.normpath(tutils.test_data.path("mitmproxy/completion"))
|
||||
get_text.return_value = os.path.join(cd, "a")
|
||||
|
Loading…
Reference in New Issue
Block a user