diff options
author | Maximilian Hils <git@maximilianhils.com> | 2018-01-05 16:04:02 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2018-01-05 16:45:43 +0100 |
commit | c2adcb58f4f5f221d10599db2c97e6cf828157c1 (patch) | |
tree | 49b83dde509fab8ecec1d7cd720e8610d3ba1226 /test | |
parent | c1c1652082f680e7448e44cfbbb536223a100a09 (diff) | |
download | mitmproxy-c2adcb58f4f5f221d10599db2c97e6cf828157c1.tar.gz mitmproxy-c2adcb58f4f5f221d10599db2c97e6cf828157c1.tar.bz2 mitmproxy-c2adcb58f4f5f221d10599db2c97e6cf828157c1.zip |
fix test flow timestamps to values that don't overflow in certain timezones
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_cut.py | 15 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_response.py | 4 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_common.py | 3 |
4 files changed, 10 insertions, 14 deletions
diff --git a/test/mitmproxy/addons/test_cut.py b/test/mitmproxy/addons/test_cut.py index 71e699db..97577c60 100644 --- a/test/mitmproxy/addons/test_cut.py +++ b/test/mitmproxy/addons/test_cut.py @@ -23,8 +23,8 @@ def test_extract(): ["request.text", "content"], ["request.content", b"content"], ["request.raw_content", b"content"], - ["request.timestamp_start", "1"], - ["request.timestamp_end", "2"], + ["request.timestamp_start", "946681200"], + ["request.timestamp_end", "946681201"], ["request.header[header]", "qvalue"], ["response.status_code", "200"], @@ -33,8 +33,8 @@ def test_extract(): ["response.content", b"message"], ["response.raw_content", b"message"], ["response.header[header-response]", "svalue"], - ["response.timestamp_start", "1"], - ["response.timestamp_end", "2"], + ["response.timestamp_start", "946681202"], + ["response.timestamp_end", "946681203"], ["client_conn.address.port", "22"], ["client_conn.address.host", "127.0.0.1"], @@ -49,10 +49,9 @@ def test_extract(): ["server_conn.sni", "address"], ["server_conn.ssl_established", "false"], ] - for t in tests: - ret = cut.extract(t[0], tf) - if ret != t[1]: - raise AssertionError("%s: Expected %s, got %s" % (t[0], t[1], ret)) + for spec, expected in tests: + ret = cut.extract(spec, tf) + assert spec and ret == expected with open(tutils.test_data.path("mitmproxy/net/data/text_cert"), "rb") as f: d = f.read() diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 1c76eb21..6e4af367 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -41,7 +41,7 @@ def test_order_generators(): tf = tflow.tflow(resp=True) rs = view.OrderRequestStart(v) - assert rs.generate(tf) == 1 + assert rs.generate(tf) == 946681200 rm = view.OrderRequestMethod(v) assert rm.generate(tf) == tf.request.method diff --git a/test/mitmproxy/net/http/test_response.py b/test/mitmproxy/net/http/test_response.py index a77435c9..af35bab3 100644 --- a/test/mitmproxy/net/http/test_response.py +++ b/test/mitmproxy/net/http/test_response.py @@ -150,10 +150,10 @@ class TestResponseUtils: n = time.time() r.headers["date"] = email.utils.formatdate(n) pre = r.headers["date"] - r.refresh(1) + r.refresh(946681202) assert pre == r.headers["date"] - r.refresh(61) + r.refresh(946681262) d = email.utils.parsedate_tz(r.headers["date"]) d = email.utils.mktime_tz(d) # Weird that this is not exact... diff --git a/test/mitmproxy/tools/console/test_common.py b/test/mitmproxy/tools/console/test_common.py index 3ab4fd67..a996c010 100644 --- a/test/mitmproxy/tools/console/test_common.py +++ b/test/mitmproxy/tools/console/test_common.py @@ -1,10 +1,7 @@ from mitmproxy.test import tflow from mitmproxy.tools.console import common -from ....conftest import skip_appveyor - -@skip_appveyor def test_format_flow(): f = tflow.tflow(resp=True) assert common.format_flow(f, True) |