summaryrefslogtreecommitdiff
path: root/tests/functional/bugfixes/test_417_openssl.py
blob: 29d82da571d70d692f2e2680c8a543351667c65b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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