aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xconfig/osdf_config.yaml2
-rw-r--r--docker/osdf/Dockerfile4
-rw-r--r--osdf/adapters/dcae/des.py15
-rwxr-xr-xosdf/adapters/dcae/message_router.py37
-rw-r--r--osdf/utils/interfaces.py22
-rw-r--r--ssl_certs/aaf_root_ca.cer31
-rw-r--r--ssl_certs/oof.crt59
-rw-r--r--ssl_certs/oof.crt.pem25
-rw-r--r--ssl_certs/oof_new.key27
-rw-r--r--test/adapters/dcae/test_des.py8
-rwxr-xr-xtest/config/osdf_config.yaml2
-rw-r--r--test/osdf/utils/test_interfaces.py12
13 files changed, 61 insertions, 184 deletions
diff --git a/.gitignore b/.gitignore
index 9061142..91882fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -119,5 +119,6 @@ xunit*.xml
# Autogenerated for simulations
simulator-logs
test/functest/simulators/config
+test/functest/simulators/policy/response-payloads
test/functest/simulators/osdf
/pylint.out
diff --git a/config/osdf_config.yaml b/config/osdf_config.yaml
index 3459939..9f98101 100755
--- a/config/osdf_config.yaml
+++ b/config/osdf_config.yaml
@@ -59,7 +59,7 @@ controllerQueryUrl: /aai/v19/query?format=resource
aaiGetInterDomainLinksUrl: /aai/v19/network/logical-links?link-type=inter-domain&operational-status=up
#DES api
-desUrl: https://des.url:9000
+desUrl: http://des.url:9000
desApiPath: /datalake/v1/exposure/
desHeaders:
Accept: application/json
diff --git a/docker/osdf/Dockerfile b/docker/osdf/Dockerfile
index c74ad5a..9d70961 100644
--- a/docker/osdf/Dockerfile
+++ b/docker/osdf/Dockerfile
@@ -60,10 +60,6 @@ RUN groupadd onap \
COPY onap-osdf-tm/optf-osdf-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-osdf.zip
COPY onap-osdf-tm/apps /opt/osdf/apps
RUN unzip -q -o -B /tmp/optf-osdf.zip -d /opt/ && rm -f /tmp/optf-osdf.zip
-RUN mkdir -p /usr/local/share/ca-certificates \
- && cp /opt/osdf/ssl_certs/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt \
- && chmod 444 /usr/local/share/ca-certificates/aafcacert.crt \
- && update-ca-certificates
RUN mkdir -p /var/log/onap/optf/osdf/ \
&& chown -R onap:onap /var/log/onap \
diff --git a/osdf/adapters/dcae/des.py b/osdf/adapters/dcae/des.py
index 57d0371..17517d7 100644
--- a/osdf/adapters/dcae/des.py
+++ b/osdf/adapters/dcae/des.py
@@ -17,9 +17,10 @@
#
import requests
-from requests.auth import HTTPBasicAuth
+from requests.exceptions import HTTPError
from osdf.config.base import osdf_config
+from osdf.utils.interfaces import RestClient
class DESException(Exception):
@@ -36,16 +37,14 @@ def extract_data(service_id, request_data):
config = osdf_config.deployment
user, password = config['desUsername'], config['desPassword']
- auth = HTTPBasicAuth(user, password)
headers = config["desHeaders"]
req_url = config["desUrl"] + config["desApiPath"] + service_id
+ rc = RestClient(userid=user, passwd=password, url=req_url, headers=headers, method="POST")
try:
- response = requests.post(req_url, data=request_data, headers=headers, auth=auth, verify=False)
+ response_json = rc.request(data=request_data)
+ return response_json.get("result")
except requests.RequestException as e:
raise DESException("Request exception was encountered {}".format(e))
-
- if response.status_code == 200:
- return response.json().get("result")
- else:
- raise DESException("Response code other than 200. Response code: {}".format(response.status_code))
+ except HTTPError as ex:
+ raise DESException("Response code other than 200. Response code: {}".format(ex.response.status_code))
diff --git a/osdf/adapters/dcae/message_router.py b/osdf/adapters/dcae/message_router.py
index caf04a4..0968812 100755
--- a/osdf/adapters/dcae/message_router.py
+++ b/osdf/adapters/dcae/message_router.py
@@ -17,8 +17,10 @@
#
import requests
-from osdf.utils.data_types import list_like
+
from osdf.operation.exceptions import MessageBusConfigurationException
+from osdf.utils.data_types import list_like
+from osdf.utils.interfaces import RestClient
class MessageRouterClient(object):
@@ -27,7 +29,8 @@ class MessageRouterClient(object):
consumer_group_id=':',
timeout_ms=15000, fetch_limit=1000,
userid_passwd=':'):
- """
+ """Class initializer
+
:param dmaap_url: protocol, host and port; can also be a list of URLs
(e.g. https://dmaap-host.onapdemo.onap.org:3905/events/org.onap.dmaap.MULTICLOUD.URGENT),
can also be a list of such URLs
@@ -44,14 +47,14 @@ class MessageRouterClient(object):
self.topic_urls = [dmaap_url] if not list_like(dmaap_url) else dmaap_url
self.timeout_ms = timeout_ms
self.fetch_limit = fetch_limit
- userid, passwd = userid_passwd.split(':')
- self.auth = (userid, passwd) if userid and passwd else None
+ self.userid, self.passwd = userid_passwd.split(':')
consumer_group, consumer_id = consumer_group_id.split(':')
self.consumer_group = consumer_group
self.consumer_id = consumer_id
def get(self, outputjson=True):
"""Fetch messages from message router (DMaaP or UEB)
+
:param outputjson: (optional, specifies if response is expected to be in json format), ignored for "POST"
:return: response as a json object (if outputjson is True) or as a string
"""
@@ -61,7 +64,7 @@ class MessageRouterClient(object):
for url in urls[:-1]:
try:
return self.http_request(method='GET', url=url, outputjson=outputjson)
- except:
+ except Exception:
pass
return self.http_request(method='GET', url=urls[-1], outputjson=outputjson)
@@ -69,13 +72,13 @@ class MessageRouterClient(object):
for url in self.topic_urls[:-1]:
try:
return self.http_request(method='POST', url=url, inputjson=inputjson, msg=msg)
- except:
+ except Exception:
pass
return self.http_request(method='POST', url=self.topic_urls[-1], inputjson=inputjson, msg=msg)
def http_request(self, url, method, inputjson=True, outputjson=True, msg=None, **kwargs):
- """
- Perform the actual URL request (GET or POST), and do error handling
+ """Perform the actual URL request (GET or POST), and do error handling
+
:param url: full URL (including topic, limit, timeout, etc.)
:param method: GET or POST
:param inputjson: Specify whether input is in json format (valid only for POST)
@@ -83,9 +86,15 @@ class MessageRouterClient(object):
:param msg: content to be posted (valid only for POST)
:return: response as a json object (if outputjson or POST) or as a string; None if error
"""
- res = requests.request(url=url, method=method, auth=self.auth, **kwargs)
- if res.status_code == requests.codes.ok:
- return res.json() if outputjson or method == "POST" else res.content
- else:
- raise Exception("HTTP Response Error: code {}; headers:{}, content: {}".format(
- res.status_code, res.headers, res.content))
+
+ rc = RestClient(userid=self.userid, passwd=self.passwd, url=url, method=method)
+ try:
+ res = rc.request(raw_response=True, data=msg, **kwargs)
+ if res.status_code == requests.codes.ok:
+ return res.json() if outputjson or method == "POST" else res.content
+ else:
+ raise Exception("HTTP Response Error: code {}; headers:{}, content: {}".format(
+ res.status_code, res.headers, res.content))
+
+ except requests.RequestException as ex:
+ raise Exception("Request Exception occurred {}".format(str(ex)))
diff --git a/osdf/utils/interfaces.py b/osdf/utils/interfaces.py
index a869d6d..93264b2 100644
--- a/osdf/utils/interfaces.py
+++ b/osdf/utils/interfaces.py
@@ -20,12 +20,15 @@ import json
import requests
import yaml
-from osdf.config.base import osdf_config, creds_prefixes
-from osdf.logging.osdf_logging import MH, debug_log
+from osdf.config.base import creds_prefixes
+from osdf.config.base import osdf_config
+from osdf.logging.osdf_logging import debug_log
+from osdf.logging.osdf_logging import MH
def get_rest_client(request_json, service):
"""Get a RestClient based on request_json's callback URL and osdf_config's credentials based on service name
+
:param request_json:
:param service: so or cm
:return: rc -- RestClient
@@ -53,7 +56,7 @@ class RestClient(object):
"""Simple REST Client that supports get/post and basic auth"""
def __init__(self, userid=None, passwd=None, log_func=None, url=None, timeout=None, headers=None,
- method="POST", req_id=None):
+ method="POST", req_id=None, verify=None):
self.auth = (userid, passwd) if userid and passwd else None
self.headers = headers if headers else {}
self.method = method
@@ -61,13 +64,15 @@ class RestClient(object):
self.log_func = log_func
self.timeout = (30, 90) if timeout is None else timeout
self.req_id = req_id
+ self.verify = verify
def add_headers(self, headers):
self.headers.update(headers)
def request(self, url=None, method=None, asjson=True, ok_codes=(2, ),
raw_response=False, noresponse=False, timeout=None, **kwargs):
- """
+ """Sends http request to the specified url
+
:param url: REST end point to query
:param method: GET or POST (default is None => self.method)
:param asjson: whether the expected response is in json format
@@ -83,9 +88,16 @@ class RestClient(object):
else:
debug_log.debug("Requesting URL: {} for request ID: {}".format(url or self.url, self.req_id))
+ if not url:
+ url = self.url
+ if not self.verify and url.startswith("https"):
+ verify = osdf_config.deployment["aaf_ca_certs"]
+ else:
+ verify = self.verify
+
res = requests.request(url=url or self.url, method=method or self.method,
auth=self.auth, headers=self.headers,
- timeout=timeout or self.timeout, **kwargs)
+ timeout=timeout or self.timeout, verify=verify, **kwargs)
if self.log_func:
self.log_func(MH.received_http_response(res))
diff --git a/ssl_certs/aaf_root_ca.cer b/ssl_certs/aaf_root_ca.cer
deleted file mode 100644
index 897c8ae..0000000
--- a/ssl_certs/aaf_root_ca.cer
+++ /dev/null
@@ -1,31 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIFPjCCAyagAwIBAgIJAJ6u7cCnzrWdMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV
-BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA0MDUx
-NDE1MjhaFw0zODAzMzExNDE1MjhaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK
-DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
-ggIBAMA5pkgRs7NhGG4ew5JouhyYakgYUyFaG121+/h8qbSdt0hVQv56+EA41Yq7
-XGie7RYDQK9NmAFF3gruE+6X7wvJiChp+Cyd7sFMnb65uWhxEdxWTM2BJFrgfzUn
-H8ZCxgaCo3XH4PzlKRy2LQQJEJECwl/RZmRCXijMt5e9h8XoZY/fKkKcZZUsWNCM
-pTo266wjvA9MXLmdgReRj0+vrCjrNqy+htwJDztoiHWiYPqT6o8EvGcgjNqjlZx7
-NUNf8MfLDByqKF6+wRbHv1GKjn3/Vijd45Fv8riyRYROiFanvbV6jIfBkv8PZbXg
-2VDWsYsgp8NAvMxK+iV8cO+Ck3lBI2GOPZbCEqpPVTYbLUz6sczAlCXwQoPzDIZY
-wYa3eR/gYLY1gP2iEVHORag3bLPap9ZX5E8DZkzTNTjovvLk8KaCmfcaUMJsBtDd
-ApcUitz10cnRyZc1sX3gE1f3DpzQM6t9C5sOV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wX
-dYY=
------END CERTIFICATE----- \ No newline at end of file
diff --git a/ssl_certs/oof.crt b/ssl_certs/oof.crt
deleted file mode 100644
index dc61a43..0000000
--- a/ssl_certs/oof.crt
+++ /dev/null
@@ -1,59 +0,0 @@
-Bag Attributes
- localKeyID: F5 64 7B F8 32 67 FD CE 81 5E 0D 13 36 B7 67 35 47 33 B8 9B
- friendlyName: oof@oof.onap.org
-subject=/C=US/O=ONAP/OU=oof@oof.onap.org/OU=OSAAF/CN=oof.api.simpledemo.onap.org
-issuer=/C=US/O=ONAP/OU=OSAAF/CN=intermediateCA_1
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIBHjANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQGEwJVUzEN
-MAsGA1UECgwET05BUDEOMAwGA1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVk
-aWF0ZUNBXzEwHhcNMTgwNDI1MTIxMzAxWhcNMTkwNDIwMTIxMzAxWjBtMQswCQYD
-VQQGEwJVUzENMAsGA1UECgwET05BUDEZMBcGA1UECwwQb29mQG9vZi5vbmFwLm9y
-ZzEOMAwGA1UECwwFT1NBQUYxJDAiBgNVBAMMG29vZi5hcGkuc2ltcGxlZGVtby5v
-bmFwLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANGpQUtgLXG3
-dVikd/QC2Q24wzeTOeZzbx3PnidNYZT5K0sJ/TdnZF6O/4+9gXQ6AQS2Q8wfQ009
-MQAA5vhUaq5yZ2K+XAtEFGln1TxTFpGu3WDOwQ800Vw18Dk8WidrkzDJv489Bn1f
-SSaPC0IaRB0K1d8BD63ZHgsuEY8lt31DX2wFWJcfN9mxNDzuLTZoLxtxKsedoZKH
-rsOOILwXOhwuunfx40i6RQN/pFX6C2i8dtOA5OwUm9Q1RrZ2Tv1Uf4IURriH6bfZ
-5n50yxTuL22TMYXsF/ohrdgwacuC0aV9ZSGhIZUJPyHVg7+QTBioHmoUJInVKuIx
-kkC4lENbLYUCAwEAAaOB+jCB9zAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIG
-wDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgU2VydmVyIENlcnRp
-ZmljYXRlMB0GA1UdDgQWBBQwbU5oHU2iYHCoVz4hFCvBW59cdTBUBgNVHSMETTBL
-gBQd5lldG54KOKRipsGF8/PP1vGX6qEwpC4wLDEOMAwGA1UECwwFT1NBQUYxDTAL
-BgNVBAoMBE9OQVAxCzAJBgNVBAYTAlVTggEBMA4GA1UdDwEB/wQEAwIF4DAdBgNV
-HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADEa
-0VuxoFIygeQTqlizpHNwfApPmlAVSKDTWuEu4rhJs8GT61EuWZQPygXEUHCYmGvJ
-GMwEGGIDGiQqxMqlqng46gksNJbi1ktXr6Du18qW7gziUd84ve8KcecjZru1Sk1e
-UJ/6WEQVE17CHKcnzQZsMDakgP+61VgKbk5NlkeF/Qh4L6/3jY7g+xoXqaId5RT9
-BetmH/cMsj33lxQTs0fcXTbAQd6BX5ug854OJ1mU4ngJnNBdmn9Ow1bB71ohf5Xv
-OEYX8+khjgjlmM0u1hBRL4qViv3y2Gzhpm1M8cETMDj4g0zIJytzIYMxO8XvDPCF
-YmVZHXJDLsCogSOmmh0=
------END CERTIFICATE-----
-Bag Attributes: <No Attributes>
-subject=/C=US/O=ONAP/OU=OSAAF/CN=intermediateCA_1
-issuer=/OU=OSAAF/O=ONAP/C=US
------BEGIN CERTIFICATE-----
-MIIEVDCCAjygAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMQ4wDAYDVQQLDAVPU0FB
-RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVMwHhcNMTgwNDA1MTQxNTQwWhcN
-MTgwNjA0MTQxNTQwWjBHMQswCQYDVQQGEwJVUzENMAsGA1UECgwET05BUDEOMAwG
-A1UECwwFT1NBQUYxGTAXBgNV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X7zgepNWlgTra4Z8Oz8iqbQk33/s2OKM4ic
-6ZezUYhNp+MuUt4Se+ufNcGV65jnUKeROtWzNLwP+xwglEFlG8aNiAORthd7QJuT
-Ey2cX7H7f38ENQ5YCriUk1nVLO9F66l/rNRzYZgQzRI3IvDW8vyM2TLW2mcZNsaf
-qjFMcCDweV2FRb8eTbmWzzB2/xTVpGzVJqzwgE+U7UtJx5CZS3wPkvXuEgvcg1tY
-m1r4NGYFvLM=
------END CERTIFICATE-----
diff --git a/ssl_certs/oof.crt.pem b/ssl_certs/oof.crt.pem
deleted file mode 100644
index 4c6eb91..0000000
--- a/ssl_certs/oof.crt.pem
+++ /dev/null
@@ -1,25 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIBHjANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQGEwJVUzEN
-MAsGA1UECgwET05BUDEOMAwGA1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVk
-aWF0ZUNBXzEwHhcNMTgwNDI1MTIxMzAxWhcNMTkwNDIwMTIxMzAxWjBtMQswCQYD
-VQQGEwJVUzENMAsGA1UECgwET05BUDEZMBcGA1UECwwQb29mQG9vZi5vbmFwLm9y
-ZzEOMAwGA1UECwwFT1NBQUYxJDAiBgNVBAMMG29vZi5hcGkuc2ltcGxlZGVtby5v
-bmFwLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANGpQUtgLXG3
-dVikd/QC2Q24wzeTOeZzbx3PnidNYZT5K0sJ/TdnZF6O/4+9gXQ6AQS2Q8wfQ009
-MQAA5vhUaq5yZ2K+XAtEFGln1TxTFpGu3WDOwQ800Vw18Dk8WidrkzDJv489Bn1f
-SSaPC0IaRB0K1d8BD63ZHgsuEY8lt31DX2wFWJcfN9mxNDzuLTZoLxtxKsedoZKH
-rsOOILwXOhwuunfx40i6RQN/pFX6C2i8dtOA5OwUm9Q1RrZ2Tv1Uf4IURriH6bfZ
-5n50yxTuL22TMYXsF/ohrdgwacuC0aV9ZSGhIZUJPyHVg7+QTBioHmoUJInVKuIx
-kkC4lENbLYUCAwEAAaOB+jCB9zAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIG
-wDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgU2VydmVyIENlcnRp
-ZmljYXRlMB0GA1UdDgQWBBQwbU5oHU2iYHCoVz4hFCvBW59cdTBUBgNVHSMETTBL
-gBQd5lldG54KOKRipsGF8/PP1vGX6qEwpC4wLDEOMAwGA1UECwwFT1NBQUYxDTAL
-BgNVBAoMBE9OQVAxCzAJBgNVBAYTAlVTggEBMA4GA1UdDwEB/wQEAwIF4DAdBgNV
-HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBADEa
-0VuxoFIygeQTqlizpHNwfApPmlAVSKDTWuEu4rhJs8GT61EuWZQPygXEUHCYmGvJ
-GMwEGGIDGiQqxMqlqng46gksNJbi1ktXr6Du18qW7gziUd84ve8KcecjZru1Sk1e
-UJ/6WEQVE17CHKcnzQZsMDakgP+61VgKbk5NlkeF/Qh4L6/3jY7g+xoXqaId5RT9
-BetmH/cMsj33lxQTs0fcXTbAQd6BX5ug854OJ1mU4ngJnNBdmn9Ow1bB71ohf5Xv
-OEYX8+khjgjlmM0u1hBRL4qViv3y2Gzhpm1M8cETMDj4g0zIJytzIYMxO8XvDPCF
-YmVZHXJDLsCogSOmmh0=
------END CERTIFICATE----- \ No newline at end of file
diff --git a/ssl_certs/oof_new.key b/ssl_certs/oof_new.key
deleted file mode 100644
index b3208c1..0000000
--- a/ssl_certs/oof_new.key
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEA0alBS2Atcbd1WKR39ALZDbjDN5M55nNvHc+eJ01hlPkrSwn9
-N2dkXo7/j72BdDoBBLZDzB9DTT0xAADm+FRqrnJnYr5cC0QUaWfVPFMWka7dY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hNrqq+8YHS4sAeCP3NxuSZv4jfZOY0yhFUhjPsxObV3b
-EQrTkVszRWWem9gE6ol37okCgYEAhEeRb7b5Em2FFmES/N7je1fa0P4+vuS+5OeB
-ZBhM44UUkaGcYAgCaIiuKRKqFTnDhzJ85fNKVQMG5cKdB3qPOcojxAeqI/B8L1Z/
-MTK9qVb8qNDQjJQ3piZr8KpqlF4qjg/giKdhned9F/42lnQCoznFmijyDw3VsYCL
-LKrxiMUCgYAvq51mzXuGRGEJp8QmVBJGfSwIlqB9F5zdkVfWADP6X99MSH0PGpvU
-SJOYO9gQJA31v3AECLUXYjYFlEX4PcAhMCwVONm2AAok0EXIc1UgJrpNkdRIjhJW
-81NkKznllRF7LownV1zoOl9CcIn8u9XoRd1OjRTzU8QTZ1QfLkexoQ==
------END RSA PRIVATE KEY-----
diff --git a/test/adapters/dcae/test_des.py b/test/adapters/dcae/test_des.py
index 6daa29b..6e2520a 100644
--- a/test/adapters/dcae/test_des.py
+++ b/test/adapters/dcae/test_des.py
@@ -19,6 +19,7 @@
import mock
from mock import patch
from requests import RequestException
+from requests.exceptions import HTTPError
import unittest
from osdf.adapters.dcae import des
from osdf.adapters.dcae.des import DESException
@@ -51,19 +52,20 @@ class TestDes(unittest.TestCase):
response.status_code = 200
response.ok = True
response.json.return_value = response_json
- self.patcher_req = patch('requests.post', return_value=response)
+ self.patcher_req = patch('requests.request', return_value=response)
self.Mock_req = self.patcher_req.start()
self.assertEqual(expected, des.extract_data(service_id, data))
self.patcher_req.stop()
response = mock.MagicMock()
response.status_code = 404
- self.patcher_req = patch('requests.post', return_value=response)
+ response.raise_for_status.side_effect = HTTPError("404")
+ self.patcher_req = patch('requests.request', return_value=response)
self.Mock_req = self.patcher_req.start()
self.assertRaises(DESException, des.extract_data, service_id, data)
self.patcher_req.stop()
- self.patcher_req = patch('requests.post', side_effect=RequestException("error"))
+ self.patcher_req = patch('requests.request', side_effect=RequestException("error"))
self.Mock_req = self.patcher_req.start()
self.assertRaises(DESException, des.extract_data, service_id, data)
self.patcher_req.stop()
diff --git a/test/config/osdf_config.yaml b/test/config/osdf_config.yaml
index 793de63..2b38ddd 100755
--- a/test/config/osdf_config.yaml
+++ b/test/config/osdf_config.yaml
@@ -72,7 +72,7 @@ aaiUrl: "https://aai.url:30233"
aaiServiceInstanceUrl : "/aai/v20/nodes/service-instances/service-instance/"
#DES api
-desUrl: https://des.url:9000
+desUrl: http://des.url:9000
desApiPath: /datalake/v1/exposure/
desHeaders:
Accept: application/json
diff --git a/test/osdf/utils/test_interfaces.py b/test/osdf/utils/test_interfaces.py
index cdb3d7a..8d66e16 100644
--- a/test/osdf/utils/test_interfaces.py
+++ b/test/osdf/utils/test_interfaces.py
@@ -16,12 +16,13 @@
# -------------------------------------------------------------------------
#
import requests
-import unittest
-
from requests.models import Response
-from osdf.utils.interfaces import RestClient, get_rest_client
+import unittest
from unittest.mock import patch
+from osdf.utils.interfaces import get_rest_client
+from osdf.utils.interfaces import RestClient
+
m1 = Response()
m1._content = b'{"msg": "OK"}'
@@ -39,7 +40,7 @@ class TestOsdfUtilsInterfaces(unittest.TestCase):
def test_rc_request(self, mock_good_response):
rc = RestClient()
rc.add_headers({})
- rc.request(req_id="testReq")
+ rc.request(url="http://localhost", req_id="testReq")
@patch('requests.request', return_value=mock_good_response)
def test_rc_request_v1(self, mock_good_response):
@@ -53,7 +54,7 @@ class TestOsdfUtilsInterfaces(unittest.TestCase):
def test_rc_request_v2(self, mock_bad_response):
rc = RestClient()
try:
- rc.request()
+ rc.request(url="http://localhost")
except requests.RequestException:
return
raise Exception("Allows bad requests instead of raising exception")
@@ -66,4 +67,3 @@ class TestOsdfUtilsInterfaces(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
-