Use handlers in http2 test suite

This commit is contained in:
Aldo Cortesi 2016-06-14 12:09:13 +12:00
parent e6fd98bb72
commit 9e63350a96

View File

@ -75,7 +75,7 @@ class TestCheckALPNMatch(tservers.ServerTestBase):
def test_check_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl(alpn_protos=[b'h2'])
protocol = HTTP2Protocol(c)
assert protocol.check_alpn()
@ -91,7 +91,7 @@ class TestCheckALPNMismatch(tservers.ServerTestBase):
def test_check_alpn(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl(alpn_protos=[b'h2'])
protocol = HTTP2Protocol(c)
with raises(NotImplementedError):
@ -124,7 +124,7 @@ class TestPerformServerConnectionPreface(tservers.ServerTestBase):
def test_perform_server_connection_preface(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
protocol = HTTP2Protocol(c)
assert not protocol.connection_preface_performed
@ -160,7 +160,7 @@ class TestPerformClientConnectionPreface(tservers.ServerTestBase):
def test_perform_client_connection_preface(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
protocol = HTTP2Protocol(c)
assert not protocol.connection_preface_performed
@ -209,7 +209,7 @@ class TestApplySettings(tservers.ServerTestBase):
def test_apply_settings(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c)
@ -304,7 +304,7 @@ class TestReadRequest(tservers.ServerTestBase):
def test_read_request(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c, is_server=True)
protocol.connection_preface_performed = True
@ -330,7 +330,7 @@ class TestReadRequestRelative(tservers.ServerTestBase):
def test_asterisk_form(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c, is_server=True)
protocol.connection_preface_performed = True
@ -353,7 +353,7 @@ class TestReadRequestAbsolute(tservers.ServerTestBase):
def test_absolute_form(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c, is_server=True)
protocol.connection_preface_performed = True
@ -379,7 +379,7 @@ class TestReadRequestConnect(tservers.ServerTestBase):
def test_connect(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c, is_server=True)
protocol.connection_preface_performed = True
@ -411,7 +411,7 @@ class TestReadResponse(tservers.ServerTestBase):
def test_read_response(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c)
protocol.connection_preface_performed = True
@ -437,7 +437,7 @@ class TestReadEmptyResponse(tservers.ServerTestBase):
def test_read_empty_response(self):
c = tcp.TCPClient(("127.0.0.1", self.port))
c.connect()
with c.connect():
c.convert_to_ssl()
protocol = HTTP2Protocol(c)
protocol.connection_preface_performed = True