aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlymanZerga11 <lymanZerga11@users.noreply.github.com>2017-02-14 21:01:01 +0800
committerGitHub <noreply@github.com>2017-02-14 21:01:01 +0800
commita52d8c1dabf668ed758d4a7af28f4e371cbf31e7 (patch)
treea7abec34903a7c4b542e20e9e0026191d3784cfb
parent26a17a3d829931999e33f462bdeac488f55f0d4b (diff)
downloadmitmproxy-a52d8c1dabf668ed758d4a7af28f4e371cbf31e7.tar.gz
mitmproxy-a52d8c1dabf668ed758d4a7af28f4e371cbf31e7.tar.bz2
mitmproxy-a52d8c1dabf668ed758d4a7af28f4e371cbf31e7.zip
Update test_flowlist.py
-rw-r--r--test/mitmproxy/console/test_flowlist.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/test/mitmproxy/console/test_flowlist.py b/test/mitmproxy/console/test_flowlist.py
index 88895ac8..16c5ad07 100644
--- a/test/mitmproxy/console/test_flowlist.py
+++ b/test/mitmproxy/console/test_flowlist.py
@@ -4,16 +4,7 @@ from mitmproxy import proxy
from mitmproxy import options
from .. import tservers
import pytest
-from unittest import mock
-
-
-class UrlError(Exception):
- pass
-
-
-def mock_log(message):
- if "Invalid URL" in message:
- raise UrlError(message)
+from unittest import mock as Mock
class TestFlowlist(tservers.MasterTest):
@@ -23,9 +14,9 @@ class TestFlowlist(tservers.MasterTest):
o = options.Options(**opts)
return console.master.ConsoleMaster(o, proxy.DummyServer())
- @mock.patch('mitmproxy.tools.console.signals.status_message.send', side_effect = mock_log)
- def test_new_request(self, test_func):
+ def test_new_request(self):
m = self.mkmaster()
x = flowlist.FlowListBox(m)
- with pytest.raises(UrlError):
+ with Mock.patch('mitmproxy.tools.console.signals.status_message.send') as mock:
x.new_request("nonexistent url", "GET")
+ mock.assert_called_once_with(message = "Invalid URL: No hostname given")