aboutsummaryrefslogtreecommitdiffstats
path: root/test/http2/test_http2_protocol.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-15 17:31:08 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 15:00:28 +0200
commitabb37a3ef52ab9a0f68dc46e4a8ca165e365139b (patch)
treeff569a1321eb3cef327d9e5f5843840a577eaeb1 /test/http2/test_http2_protocol.py
parent20c136e070cee0e93e870bf32199cb36b1b85275 (diff)
downloadmitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.gz
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.tar.bz2
mitmproxy-abb37a3ef52ab9a0f68dc46e4a8ca165e365139b.zip
http2: improve test suite
Diffstat (limited to 'test/http2/test_http2_protocol.py')
-rw-r--r--test/http2/test_http2_protocol.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/http2/test_http2_protocol.py b/test/http2/test_http2_protocol.py
index 34c69fa9..231b35e0 100644
--- a/test/http2/test_http2_protocol.py
+++ b/test/http2/test_http2_protocol.py
@@ -300,8 +300,9 @@ class TestReadRequest(test.ServerTestBase):
c.convert_to_ssl()
protocol = http2.HTTP2Protocol(c, is_server=True)
- headers, body = protocol.read_request()
+ stream_id, headers, body = protocol.read_request()
+ assert stream_id
assert headers == {':method': 'GET', ':path': '/', ':scheme': 'https'}
assert body == b'foobar'
@@ -309,17 +310,17 @@ class TestReadRequest(test.ServerTestBase):
class TestCreateResponse():
c = tcp.TCPClient(("127.0.0.1", 0))
- def test_create_request_simple(self):
+ def test_create_response_simple(self):
bytes = http2.HTTP2Protocol(self.c, is_server=True).create_response(200)
assert len(bytes) == 1
assert bytes[0] ==\
'00000101050000000288'.decode('hex')
- def test_create_request_with_body(self):
+ def test_create_response_with_body(self):
bytes = http2.HTTP2Protocol(self.c, is_server=True).create_response(
- 200, [(b'foo', b'bar')], 'foobar')
+ 200, 1, [(b'foo', b'bar')], 'foobar')
assert len(bytes) == 2
assert bytes[0] ==\
- '00000901040000000288408294e7838c767f'.decode('hex')
+ '00000901040000000188408294e7838c767f'.decode('hex')
assert bytes[1] ==\
- '000006000100000002666f6f626172'.decode('hex')
+ '000006000100000001666f6f626172'.decode('hex')