This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 99import requests
1010import threading
1111import hyper
12+ import hyper .http11 .connection
1213import pytest
1314from hyper .compat import ssl
1415from 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
You can’t perform that action at this time.
0 commit comments