aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornish21 <hegde.nishanth@gmail.com>2017-01-25 22:19:56 +0530
committerThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-01-25 17:49:56 +0100
commitab45e4d183fe19a15cbe58f1dfbbde041e7c88bd (patch)
tree8fdcfe78b3fd3b3312acf3d88101f011029664e6 /test
parente076c23f8daf01d2acddd8e836366d652e0e0dce (diff)
downloadmitmproxy-ab45e4d183fe19a15cbe58f1dfbbde041e7c88bd.tar.gz
mitmproxy-ab45e4d183fe19a15cbe58f1dfbbde041e7c88bd.tar.bz2
mitmproxy-ab45e4d183fe19a15cbe58f1dfbbde041e7c88bd.zip
write errors to stderr (#1952)
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_termlog.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/mitmproxy/addons/test_termlog.py b/test/mitmproxy/addons/test_termlog.py
index d9e18134..9d49a8c0 100644
--- a/test/mitmproxy/addons/test_termlog.py
+++ b/test/mitmproxy/addons/test_termlog.py
@@ -1,16 +1,18 @@
-import io
-
from mitmproxy.addons import termlog
from mitmproxy import log
from mitmproxy.tools import dump
class TestTermLog:
- def test_simple(self):
- sio = io.StringIO()
- t = termlog.TermLog(outfile=sio)
+ def test_simple(self, capsys):
+ t = termlog.TermLog()
t.configure(dump.Options(verbosity = 2), set([]))
t.log(log.LogEntry("one", "info"))
- assert "one" in sio.getvalue()
t.log(log.LogEntry("two", "debug"))
- assert "two" not in sio.getvalue()
+ t.log(log.LogEntry("three", "warn"))
+ t.log(log.LogEntry("four", "error"))
+ out, err = capsys.readouterr()
+ assert "one" in out
+ assert "two" not in out
+ assert "three" in out
+ assert "four" in err