aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-10-31 12:49:46 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-11-18 11:22:35 +0000
commitdecd6fb650c78729c9527f0eae9a752e90c369f3 (patch)
tree02c49322bc3d77286763d257162fc32a195b9bec
parent960567f4f29e9c26d7be2088a1396d9c69ce12fe (diff)
Disable InsecureRequestWarning from requests library
Globally disable InsecureRequestWarning coming from requests library for both pre 2.16.0 and for >= 2.16.0 versions. Change-Id: Ibf4e749086265e8726e90a2f8b4c1c9df3b2c55d Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com> Issue-ID: TEST-227
-rwxr-xr-xtest/vcpe/vcpe.py6
-rwxr-xr-xtest/vcpe/vcpecommon.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py
index c768aa84d..bf6fcafbc 100755
--- a/test/vcpe/vcpe.py
+++ b/test/vcpe/vcpe.py
@@ -13,7 +13,13 @@ import vcpe_custom_service
import csar_parser
import config_sdnc_so
import json
+import urllib3
+# disable InsecureRequestWarning warning in requests < 2.16.0
+urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+# disable InsecureRequestWarning warning in requests >= 2.16.0
+from requests.packages.urllib3.exceptions import InsecureRequestWarning
+requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def config_sniro(vcpecommon, vgmux_svc_instance_uuid, vbrg_svc_instance_uuid):
logger = logging.getLogger(__name__)
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 371029e19..7ce223ac9 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -369,7 +369,6 @@ class VcpeCommon:
sys.exit(1)
# Check policy already applied
- requests.packages.urllib3.disable_warnings()
policy_exists_req = requests.get(self.policy_pap_get_url.format(
p_pap_cluster_ip), auth=self.policy_userpass,
verify=False, headers=self.policy_headers)
@@ -440,7 +439,6 @@ class VcpeCommon:
self.hosts['aai-inst1'], self.aai_query_port, search_node_type, key, node_uuid)
headers = {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-FromAppID': 'vCPE-Robot', 'X-TransactionId': 'get_aai_subscr'}
- requests.packages.urllib3.disable_warnings()
r = requests.get(url, headers=headers, auth=self.aai_userpass, verify=False)
response = r.json()
self.logger.debug('aai query: ' + url)