diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-01 19:24:30 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-01 19:24:30 +0100 |
commit | 7c83a709ea06f3b538f446860f3c7ed463a29b1f (patch) | |
tree | 18d0720e0bbeb934e5976614dd8834d52de89271 /test/test_tcp.py | |
parent | d253ebc142d80708a1bdc065d3db05d1394e3819 (diff) | |
download | mitmproxy-7c83a709ea06f3b538f446860f3c7ed463a29b1f.tar.gz mitmproxy-7c83a709ea06f3b538f446860f3c7ed463a29b1f.tar.bz2 mitmproxy-7c83a709ea06f3b538f446860f3c7ed463a29b1f.zip |
add test for Reader.peek()
Diffstat (limited to 'test/test_tcp.py')
-rw-r--r-- | test/test_tcp.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_tcp.py b/test/test_tcp.py index 738fb2eb..a68bf1e6 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -713,6 +713,20 @@ class TestFileLike: tutils.raises(TcpReadIncomplete, s.safe_read, 10) +class TestPeek(tservers.ServerTestBase): + handler = EchoHandler + + def test_peek(self): + testval = b"peek!\n" + c = tcp.TCPClient(("127.0.0.1", self.port)) + c.connect() + c.wfile.write(testval) + c.wfile.flush() + + assert c.rfile.peek(4) == "peek"[:4] + assert c.rfile.peek(6) == testval + + class TestAddress: def test_simple(self): |