-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes pyopenssl issue with urllib3 (#420)
closes #417
- Loading branch information
1 parent
2224470
commit edfb125
Showing
2 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |