diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_clientplayback.py | 6 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_dumper.py | 5 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_evenstore.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/console/test_pathedit.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/test_api.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/mock_urwid.py | 3 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http1/test_read.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_cookies.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_encoding.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/test_tcp.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_controller.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_flowfilter.py | 3 | ||||
-rw-r--r-- | test/mitmproxy/test_proxy.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_server.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_web_app.py | 7 | ||||
-rw-r--r-- | test/mitmproxy/utils/test_typecheck.py | 3 | ||||
-rw-r--r-- | test/mitmproxy/utils/test_version_check.py | 2 | ||||
-rw-r--r-- | test/pathod/test_pathoc.py | 2 | ||||
-rw-r--r-- | test/pathod/test_pathoc_cmdline.py | 2 | ||||
-rw-r--r-- | test/pathod/test_pathod_cmdline.py | 2 | ||||
-rw-r--r-- | test/pathod/test_protocols_http2.py | 2 |
21 files changed, 30 insertions, 27 deletions
diff --git a/test/mitmproxy/addons/test_clientplayback.py b/test/mitmproxy/addons/test_clientplayback.py index 32eca536..ef1f0782 100644 --- a/test/mitmproxy/addons/test_clientplayback.py +++ b/test/mitmproxy/addons/test_clientplayback.py @@ -1,5 +1,5 @@ import os -import mock +from unittest import mock from mitmproxy.test import tflow from mitmproxy.test import tutils @@ -33,7 +33,7 @@ class TestClientPlayback: with mock.patch(RP) as rp: assert not cp.current_thread cp.tick() - rp.assert_called() + assert rp.called assert cp.current_thread cp.keepserving = False @@ -41,7 +41,7 @@ class TestClientPlayback: cp.current_thread = None with mock.patch("mitmproxy.master.Master.shutdown") as sd: cp.tick() - sd.assert_called() + assert sd.called cp.current_thread = MockThread() with mock.patch("mitmproxy.master.Master.shutdown") as sd: diff --git a/test/mitmproxy/addons/test_dumper.py b/test/mitmproxy/addons/test_dumper.py index d8d2deeb..7ac17a7c 100644 --- a/test/mitmproxy/addons/test_dumper.py +++ b/test/mitmproxy/addons/test_dumper.py @@ -1,4 +1,7 @@ import io +import shutil +from unittest import mock + from mitmproxy.test import tflow from mitmproxy.test import taddons from mitmproxy.test import tutils @@ -7,8 +10,6 @@ from mitmproxy.addons import dumper from mitmproxy import exceptions from mitmproxy.tools import dump from mitmproxy import http -import shutil -import mock def test_configure(): diff --git a/test/mitmproxy/addons/test_evenstore.py b/test/mitmproxy/addons/test_evenstore.py index 78eb3287..f54b9980 100644 --- a/test/mitmproxy/addons/test_evenstore.py +++ b/test/mitmproxy/addons/test_evenstore.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock from mitmproxy import log from mitmproxy.addons import eventstore diff --git a/test/mitmproxy/console/test_pathedit.py b/test/mitmproxy/console/test_pathedit.py index b326ed6d..bd064e5f 100644 --- a/test/mitmproxy/console/test_pathedit.py +++ b/test/mitmproxy/console/test_pathedit.py @@ -3,7 +3,7 @@ from os.path import normpath from mitmproxy.tools.console import pathedit from mitmproxy.test import tutils -from mock import patch +from unittest.mock import patch class TestPathCompleter: diff --git a/test/mitmproxy/contentviews/test_api.py b/test/mitmproxy/contentviews/test_api.py index 8e6c3427..b4bd0106 100644 --- a/test/mitmproxy/contentviews/test_api.py +++ b/test/mitmproxy/contentviews/test_api.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock from mitmproxy import contentviews from mitmproxy.exceptions import ContentViewException diff --git a/test/mitmproxy/mock_urwid.py b/test/mitmproxy/mock_urwid.py index 191210bf..9cc41abc 100644 --- a/test/mitmproxy/mock_urwid.py +++ b/test/mitmproxy/mock_urwid.py @@ -1,6 +1,7 @@ import os import sys -import mock +from unittest import mock + if os.name == "nt": m = mock.Mock() m.__version__ = "1.1.1" diff --git a/test/mitmproxy/net/http/http1/test_read.py b/test/mitmproxy/net/http/http1/test_read.py index 20997259..72f255b3 100644 --- a/test/mitmproxy/net/http/http1/test_read.py +++ b/test/mitmproxy/net/http/http1/test_read.py @@ -1,5 +1,5 @@ from io import BytesIO -from mock import Mock +from unittest.mock import Mock import pytest from mitmproxy import exceptions diff --git a/test/mitmproxy/net/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py index 8c9c0c32..9c72ce3f 100644 --- a/test/mitmproxy/net/http/test_cookies.py +++ b/test/mitmproxy/net/http/test_cookies.py @@ -1,9 +1,9 @@ import time +from unittest import mock from mitmproxy.net.http import cookies from mitmproxy.test.tutils import raises -import mock cookie_pairs = [ [ diff --git a/test/mitmproxy/net/http/test_encoding.py b/test/mitmproxy/net/http/test_encoding.py index d8fa5e76..67d1a61b 100644 --- a/test/mitmproxy/net/http/test_encoding.py +++ b/test/mitmproxy/net/http/test_encoding.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock import pytest from mitmproxy.net.http import encoding diff --git a/test/mitmproxy/net/test_tcp.py b/test/mitmproxy/net/test_tcp.py index fe44973b..ef7d3ea4 100644 --- a/test/mitmproxy/net/test_tcp.py +++ b/test/mitmproxy/net/test_tcp.py @@ -5,8 +5,8 @@ import socket import random import os import threading -import mock import pytest +from unittest import mock from OpenSSL import SSL from mitmproxy import certs diff --git a/test/mitmproxy/test_controller.py b/test/mitmproxy/test_controller.py index 5cc36532..052affb8 100644 --- a/test/mitmproxy/test_controller.py +++ b/test/mitmproxy/test_controller.py @@ -1,6 +1,6 @@ from threading import Thread, Event -from mock import Mock +from unittest.mock import Mock from mitmproxy import controller import queue diff --git a/test/mitmproxy/test_flowfilter.py b/test/mitmproxy/test_flowfilter.py index 2d409994..1fb97126 100644 --- a/test/mitmproxy/test_flowfilter.py +++ b/test/mitmproxy/test_flowfilter.py @@ -1,6 +1,7 @@ import io +from unittest.mock import patch + from mitmproxy.test import tflow -from mock import patch from mitmproxy import flowfilter from . import tutils as ttutils diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py index 0d63f147..6e0ef846 100644 --- a/test/mitmproxy/test_proxy.py +++ b/test/mitmproxy/test_proxy.py @@ -1,6 +1,6 @@ from mitmproxy.test import tflow import os -import mock +from unittest import mock import argparse from OpenSSL import SSL diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 332d6138..1388a4d8 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -2,7 +2,7 @@ import os import socket import time -import mock +from unittest import mock from mitmproxy.test import tutils from mitmproxy import controller diff --git a/test/mitmproxy/test_web_app.py b/test/mitmproxy/test_web_app.py index 7da5e4e9..59d92c0f 100644 --- a/test/mitmproxy/test_web_app.py +++ b/test/mitmproxy/test_web_app.py @@ -1,15 +1,16 @@ import json as _json +from unittest import mock -import mock import tornado.testing +from tornado import httpclient +from tornado import websocket + from mitmproxy import exceptions from mitmproxy import proxy from mitmproxy import options from mitmproxy.test import tflow from mitmproxy.tools.web import app from mitmproxy.tools.web import master as webmaster -from tornado import httpclient -from tornado import websocket def json(resp: httpclient.HTTPResponse): diff --git a/test/mitmproxy/utils/test_typecheck.py b/test/mitmproxy/utils/test_typecheck.py index 0ed440eb..a21c65c9 100644 --- a/test/mitmproxy/utils/test_typecheck.py +++ b/test/mitmproxy/utils/test_typecheck.py @@ -1,7 +1,6 @@ import io import typing - -import mock +from unittest import mock import pytest from mitmproxy.utils import typecheck diff --git a/test/mitmproxy/utils/test_version_check.py b/test/mitmproxy/utils/test_version_check.py index 5c8d8c8c..d7929378 100644 --- a/test/mitmproxy/utils/test_version_check.py +++ b/test/mitmproxy/utils/test_version_check.py @@ -1,5 +1,5 @@ import io -import mock +from unittest import mock from mitmproxy.utils import version_check diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py index 274e2be7..23e0f973 100644 --- a/test/pathod/test_pathoc.py +++ b/test/pathod/test_pathoc.py @@ -1,5 +1,5 @@ import io -from mock import Mock +from unittest.mock import Mock import pytest from mitmproxy.net import http diff --git a/test/pathod/test_pathoc_cmdline.py b/test/pathod/test_pathoc_cmdline.py index 3b54403f..710a816f 100644 --- a/test/pathod/test_pathoc_cmdline.py +++ b/test/pathod/test_pathoc_cmdline.py @@ -1,5 +1,5 @@ import io -import mock +from unittest import mock from pathod import pathoc_cmdline as cmdline diff --git a/test/pathod/test_pathod_cmdline.py b/test/pathod/test_pathod_cmdline.py index 290f5d9f..34baf491 100644 --- a/test/pathod/test_pathod_cmdline.py +++ b/test/pathod/test_pathod_cmdline.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock from pathod import pathod_cmdline as cmdline diff --git a/test/pathod/test_protocols_http2.py b/test/pathod/test_protocols_http2.py index 8531887b..2f92dc54 100644 --- a/test/pathod/test_protocols_http2.py +++ b/test/pathod/test_protocols_http2.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock import codecs import hyperframe |