improve injection code, make backwards compat explicit, make ssl-api explicit#268
Conversation
01435fa to
199e903
Compare
3 similar comments
199e903 to
8b30c00
Compare
cc098a9 to
58f8742
Compare
|
I like the function |
|
Also, have a look at code coverage, not sure what happened but it went down. |
|
sure. take your time. i my mind having a dedicated place for each injection logic is more readable, especially considering the python- or urllib3-version specific things. |
|
That's the other thing, I don't think we need to add a new dependency for something as simple as trying to import something from a module. |
|
sleep on it and ping me tomorrow and I'll take care of whatever decision you come to :) |
|
I've just had an idea. It would be nice if we had a dictionary of everything we patched, with the real and the mocked version, and use it to bring the status back, instead of using variables to know if I patched or not that thing like it is currently done. |
|
I'll give it a try |
|
It could be literally used both ways. As a way to define the monkey-patches and to bring back their counterparts. |
58f8742 to
69c3d16
Compare
|
ok.
|
69c3d16 to
e485148
Compare
e485148 to
a155190
Compare
|
…explicit (#268) * refactor: make injection code more readable and make backwards-compat explicit * refactor: move ssl socket-wrapping code to ssl/socket.py * refactor: convert MocketSSLContext.wrap_socket and wrap_bio to instance-methods * refactor: MocketSSLSocket use proper ssl-context instead of urllib3



This PR introduces the following changes:
ssl.context.mock_wrap_socketto mirror stdlib apiMocketSSLContext.wrap_socketand.wrap_bioto instance-methods to mirror stdlib apiurllib3.mock_ssl_wrap_socketmethods mirror urllib3 apissl.SSLContextinMocketSSLSocketinstead ofurllib3.ssl_wrap_socket