aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_tcp.py
diff options
context:
space:
mode:
authorRouli <rouli.net@gmail.com>2013-01-16 22:30:19 +0200
committerRouli <rouli.net@gmail.com>2013-01-16 22:30:19 +0200
commit04048b4c73f477f11d41788366eddffaae6bbb20 (patch)
treee9110e1a686f64d4567ae4bd44842d70c9aab4f4 /test/test_tcp.py
parentf673cfed634a1a1cc38dcca9a460d6054555f330 (diff)
downloadmitmproxy-04048b4c73f477f11d41788366eddffaae6bbb20.tar.gz
mitmproxy-04048b4c73f477f11d41788366eddffaae6bbb20.tar.bz2
mitmproxy-04048b4c73f477f11d41788366eddffaae6bbb20.zip
renaming the timestamp in preparation of other timestamps that will be added later, adding tests
Diffstat (limited to 'test/test_tcp.py')
-rw-r--r--test/test_tcp.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_tcp.py b/test/test_tcp.py
index 5a12da91..d27a678a 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -313,3 +313,27 @@ class TestFileLike:
s.write("x")
assert s.get_log() == "xx"
+ def test_reset_timestamps(self):
+ s = cStringIO.StringIO("foobar\nfoobar")
+ s = tcp.Reader(s)
+ s.first_byte_timestamp = 500
+ s.reset_timestamps()
+ assert not s.first_byte_timestamp
+
+ def test_first_byte_timestamp_updated_on_read(self):
+ s = cStringIO.StringIO("foobar\nfoobar")
+ s = tcp.Reader(s)
+ s.read(1)
+ assert s.first_byte_timestamp
+ expected = s.first_byte_timestamp
+ s.read(5)
+ assert s.first_byte_timestamp == expected
+
+ def test_first_byte_timestamp_updated_on_readline(self):
+ s = cStringIO.StringIO("foobar\nfoobar\nfoobar")
+ s = tcp.Reader(s)
+ s.readline()
+ assert s.first_byte_timestamp
+ expected = s.first_byte_timestamp
+ s.readline()
+ assert s.first_byte_timestamp == expected