diff options
| author | Gabriel Falcão <gabrielfalcao@users.noreply.github.com> | 2021-05-14 00:06:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-14 00:06:43 +0200 |
| commit | edfb1256e4383ee6e7181d888f96d42f14781d5c (patch) | |
| tree | f0be453fc75cc798bd0856afaa4a7f9ef7a02cfa /tests/functional/bugfixes | |
| parent | 2224470ecc15daa78832aefb50c03e9d7aab454e (diff) | |
| download | httpretty-edfb1256e4383ee6e7181d888f96d42f14781d5c.tar.gz | |
Fixes pyopenssl issue with urllib3 (#420)
closes #417
Diffstat (limited to 'tests/functional/bugfixes')
| -rw-r--r-- | tests/functional/bugfixes/test_417_openssl.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/functional/bugfixes/test_417_openssl.py b/tests/functional/bugfixes/test_417_openssl.py new file mode 100644 index 0000000..29d82da --- /dev/null +++ b/tests/functional/bugfixes/test_417_openssl.py @@ -0,0 +1,31 @@ +# This test is based on @ento's example snippet: +# https://gist.github.com/ento/e1e33d7d67e406bf03fe61f018404c21 + +# Original Issue: +# https://github.com/gabrielfalcao/HTTPretty/issues/417 +import httpretty +import requests +import urllib3 +from sure import expect +from unittest import skipIf +try: + from urllib3.contrib.pyopenssl import extract_from_urllib3 +except Exception: + extract_from_urllib3 = None + + +@skipIf(extract_from_urllib3 is None, + "urllib3.contrib.pyopenssl.extract_from_urllib3 does not exist") +def test_enable_disable_httpretty_extract(): + expect(urllib3.util.IS_PYOPENSSL).to.be.false + httpretty.enable() + httpretty.disable() + extract_from_urllib3() + expect(urllib3.util.IS_PYOPENSSL).to.be.false + +def test_enable_disable_httpretty(): + expect(urllib3.util.IS_PYOPENSSL).to.be.false + httpretty.enable() + httpretty.disable() + extract_from_urllib3() + expect(urllib3.util.IS_PYOPENSSL).to.be.false |
