Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit b966664

Browse files
committed
Force adapter tests to upgrade.
1 parent 06535a1 commit b966664

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/test_integration.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import requests
1010
import threading
1111
import hyper
12+
import hyper.http11.connection
1213
import pytest
1314
from hyper.compat import ssl
1415
from hyper.contrib import HTTP20Adapter
@@ -495,9 +496,19 @@ def socket_handler(listener):
495496

496497
self.tear_down()
497498

498-
def test_adapter_sending_values(self):
499+
def test_adapter_sending_values(self, monkeypatch):
499500
self.set_up()
500501

502+
# We need to patch the ssl_wrap_socket method to ensure that we
503+
# forcefully upgrade.
504+
old_wrap_socket = hyper.http11.connection.wrap_socket
505+
506+
def wrap(*args):
507+
sock, _ = old_wrap_socket(*args)
508+
return sock, 'h2'
509+
510+
monkeypatch.setattr(hyper.http11.connection, 'wrap_socket', wrap)
511+
501512
data = []
502513
send_event = threading.Event()
503514

@@ -527,9 +538,9 @@ def socket_handler(listener):
527538
self._start_server(socket_handler)
528539

529540
s = requests.Session()
530-
s.mount('http://%s' % self.host, HTTP20Adapter())
541+
s.mount('https://%s' % self.host, HTTP20Adapter())
531542
r = s.post(
532-
'http://%s:%s/some/path' % (self.host, self.port),
543+
'https://%s:%s/some/path' % (self.host, self.port),
533544
data='hi there',
534545
)
535546

0 commit comments

Comments
 (0)