From 836ca40cdcd37cd5f6c78fc9c1bfd5255db9f5ad Mon Sep 17 00:00:00 2001
From: Johnny <j796160836@gmail.com>
Date: Tue, 18 Jul 2017 15:11:35 +0800
Subject: [PATCH] Fix "SSL certificate problem" by using certifi

---
 pyresttest/resttest.py | 2 ++
 setup.py               | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/pyresttest/resttest.py b/pyresttest/resttest.py
index 31d42288..f5c83cf5 100644
--- a/pyresttest/resttest.py
+++ b/pyresttest/resttest.py
@@ -5,6 +5,7 @@
 import traceback
 import yaml
 import pycurl
+import certifi
 import json
 import csv
 import logging
@@ -324,6 +325,7 @@ def run_test(mytest, test_config=TestConfig(), context=None, curl_handle=None, *
     # reset the body, it holds values from previous runs otherwise
     headers = MyIO()
     body = MyIO()
+    curl.setopt(pycurl.CAINFO, certifi.where())
     curl.setopt(pycurl.WRITEFUNCTION, body.write)
     curl.setopt(pycurl.HEADERFUNCTION, headers.write)
     if test_config.verbose:
diff --git a/setup.py b/setup.py
index 29172bcc..7ade0164 100755
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
     from distutils.core import setup
 
 # Future is needed for pip distribution for python 3 support
-dependencies = ['pyyaml', 'pycurl']
+dependencies = ['pyyaml', 'pycurl', 'certifi']
 test_dependencies = ['django==1.6.5','django-tastypie==0.12.1','jsonpath','jmespath']
 
 # Add additional compatibility shims