From 26a17a3d829931999e33f462bdeac488f55f0d4b Mon Sep 17 00:00:00 2001 From: lymanZerga11 Date: Mon, 13 Feb 2017 15:05:29 +0800 Subject: [PATCH] Update test_flowlist.py --- test/mitmproxy/console/test_flowlist.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/mitmproxy/console/test_flowlist.py b/test/mitmproxy/console/test_flowlist.py index 0d218e754..88895ac86 100644 --- a/test/mitmproxy/console/test_flowlist.py +++ b/test/mitmproxy/console/test_flowlist.py @@ -11,8 +11,9 @@ class UrlError(Exception): pass -def mock_add_log(message): - raise UrlError(message) +def mock_log(message): + if "Invalid URL" in message: + raise UrlError(message) class TestFlowlist(tservers.MasterTest): @@ -22,9 +23,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_add_log) + @mock.patch('mitmproxy.tools.console.signals.status_message.send', side_effect = mock_log) def test_new_request(self, test_func): m = self.mkmaster() x = flowlist.FlowListBox(m) - with pytest.raises(UrlError) as e: + with pytest.raises(UrlError): x.new_request("nonexistent url", "GET")