| |
@@ -1,7 +1,8 @@
|
| |
- diff -Nur httplib2-0.13.0.orig/python2/httplib2/certs.py httplib2-0.13.0/python2/httplib2/certs.py
|
| |
- --- httplib2-0.13.0.orig/python2/httplib2/certs.py 2019-06-06 12:46:32.000000000 -0700
|
| |
- +++ httplib2-0.13.0/python2/httplib2/certs.py 2019-06-30 14:29:14.050085981 -0700
|
| |
- @@ -23,6 +23,7 @@
|
| |
+ diff --git a/python2/httplib2/certs.py b/python2/httplib2/certs.py
|
| |
+ index 59d1ffc..a2e7513 100644
|
| |
+ --- a/python2/httplib2/certs.py
|
| |
+ +++ b/python2/httplib2/certs.py
|
| |
+ @@ -23,6 +23,7 @@ BUILTIN_CA_CERTS = os.path.join(
|
| |
os.path.dirname(os.path.abspath(__file__)), "cacerts.txt"
|
| |
)
|
| |
|
| |
@@ -9,7 +10,7 @@
|
| |
|
| |
def where():
|
| |
env = os.environ.get("HTTPLIB2_CA_CERTS")
|
| |
- @@ -35,7 +36,7 @@
|
| |
+ @@ -35,7 +36,7 @@ def where():
|
| |
return custom_ca_locater_where()
|
| |
if certifi_available:
|
| |
return certifi_where()
|
| |
@@ -18,10 +19,11 @@
|
| |
|
| |
|
| |
if __name__ == "__main__":
|
| |
- diff -Nur httplib2-0.13.0.orig/python3/httplib2/certs.py httplib2-0.13.0/python3/httplib2/certs.py
|
| |
- --- httplib2-0.13.0.orig/python3/httplib2/certs.py 2019-06-06 12:46:32.000000000 -0700
|
| |
- +++ httplib2-0.13.0/python3/httplib2/certs.py 2019-06-30 14:29:38.778214191 -0700
|
| |
- @@ -23,6 +23,8 @@
|
| |
+ diff --git a/python3/httplib2/certs.py b/python3/httplib2/certs.py
|
| |
+ index 59d1ffc..2708393 100644
|
| |
+ --- a/python3/httplib2/certs.py
|
| |
+ +++ b/python3/httplib2/certs.py
|
| |
+ @@ -23,6 +23,8 @@ BUILTIN_CA_CERTS = os.path.join(
|
| |
os.path.dirname(os.path.abspath(__file__)), "cacerts.txt"
|
| |
)
|
| |
|
| |
@@ -30,7 +32,7 @@
|
| |
|
| |
def where():
|
| |
env = os.environ.get("HTTPLIB2_CA_CERTS")
|
| |
- @@ -35,7 +37,7 @@
|
| |
+ @@ -35,7 +37,7 @@ def where():
|
| |
return custom_ca_locater_where()
|
| |
if certifi_available:
|
| |
return certifi_where()
|
| |
@@ -39,3 +41,39 @@
|
| |
|
| |
|
| |
if __name__ == "__main__":
|
| |
+ diff --git a/tests/test_cacerts_from_env.py b/tests/test_cacerts_from_env.py
|
| |
+ index cb2bd9f..0fed4d5 100644
|
| |
+ --- a/tests/test_cacerts_from_env.py
|
| |
+ +++ b/tests/test_cacerts_from_env.py
|
| |
+ @@ -7,6 +7,7 @@ import httplib2
|
| |
+
|
| |
+
|
| |
+ CA_CERTS_BUILTIN = os.path.join(os.path.dirname(httplib2.__file__), "cacerts.txt")
|
| |
+ +FEDORA_CA_CERTS = "/etc/pki/tls/certs/ca-bundle.crt"
|
| |
+ CERTIFI_CERTS_FILE = "unittest_certifi_file"
|
| |
+ CUSTOM_CA_CERTS = "unittest_custom_ca_certs"
|
| |
+
|
| |
+ @@ -32,7 +33,7 @@ def ca_certs_tmpfile(clean_env):
|
| |
+ @mock.patch("httplib2.certs.certifi_available", False)
|
| |
+ @mock.patch("httplib2.certs.custom_ca_locater_available", False)
|
| |
+ def test_certs_file_from_builtin(clean_env):
|
| |
+ - assert httplib2.certs.where() == CA_CERTS_BUILTIN
|
| |
+ + assert httplib2.certs.where() == FEDORA_CA_CERTS
|
| |
+
|
| |
+
|
| |
+ @mock.patch("httplib2.certs.certifi_available", False)
|
| |
+ @@ -44,7 +45,7 @@ def test_certs_file_from_environment(ca_certs_tmpfile):
|
| |
+ with pytest.raises(RuntimeError):
|
| |
+ httplib2.certs.where()
|
| |
+ os.environ.pop("HTTPLIB2_CA_CERTS")
|
| |
+ - assert httplib2.certs.where() == CA_CERTS_BUILTIN
|
| |
+ + assert httplib2.certs.where() == FEDORA_CA_CERTS
|
| |
+
|
| |
+
|
| |
+ @mock.patch("httplib2.certs.certifi_where", mock.MagicMock(return_value=CERTIFI_CERTS_FILE))
|
| |
+ @@ -69,4 +70,4 @@ def test_with_certifi_removed_from_modules(ca_certs_tmpfile):
|
| |
+ os.environ["HTTPLIB2_CA_CERTS"] = ca_certs_tmpfile
|
| |
+ assert httplib2.certs.where() == ca_certs_tmpfile
|
| |
+ os.environ.pop("HTTPLIB2_CA_CERTS")
|
| |
+ - assert httplib2.certs.where() == CA_CERTS_BUILTIN
|
| |
+ + assert httplib2.certs.where() == FEDORA_CA_CERTS
|
| |
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1830222
Scratchbuild: https://koji.fedoraproject.org/koji/taskinfo?taskID=44090826