summaryrefslogtreecommitdiffstats
path: root/robotframework-onap/ONAPLibrary/BaseSOKeywords.py
diff options
context:
space:
mode:
Diffstat (limited to 'robotframework-onap/ONAPLibrary/BaseSOKeywords.py')
-rw-r--r--robotframework-onap/ONAPLibrary/BaseSOKeywords.py45
1 files changed, 4 insertions, 41 deletions
diff --git a/robotframework-onap/ONAPLibrary/BaseSOKeywords.py b/robotframework-onap/ONAPLibrary/BaseSOKeywords.py
index f262616..dae3ea6 100644
--- a/robotframework-onap/ONAPLibrary/BaseSOKeywords.py
+++ b/robotframework-onap/ONAPLibrary/BaseSOKeywords.py
@@ -11,8 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-from RequestsLibrary import RequestsLibrary
-from robot.api import logger
+
from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn
@@ -31,52 +30,16 @@ class BaseSOKeywords(object):
@keyword
def run_get_request(self, endpoint, data_path, accept="application/json", auth=None):
"""Runs an SO get request"""
- resp = self.get_request(endpoint, data_path, accept, auth)
+ resp = self.reqs.get_request("so", endpoint, data_path, accept, auth)
self.builtin.should_be_equal_as_strings(resp.status_code, "200")
return resp
@keyword
def run_post_request(self, endpoint, data_path, data, accept="application/json", auth=None):
"""Runs an SO post request"""
- return self.post_request(endpoint, data_path, data, accept, auth)
+ return self.reqs.post_request("so", endpoint, data_path, data, accept, auth)
@keyword
def run_put_request(self, endpoint, data_path, data, accept="application/json", auth=None):
"""Runs an SO post request"""
- return self.put_request(endpoint, data_path, data, accept, auth)
-
- def get_request(self, endpoint, data_path, accept="application/json", auth=None):
- """Runs an SO get request"""
- logger.info("Creating session" + endpoint)
- RequestsLibrary().create_session("so", endpoint, auth=auth)
- headers = self.reqs.create_headers(accept=accept)
- resp = RequestsLibrary().get_request("so", data_path, headers=headers)
- logger.info("Received response from so " + resp.text)
- return resp
-
- def post_request(self, endpoint, data_path, data, accept="application/json", auth=None):
- """Runs an SO post request"""
- logger.info("Creating session" + endpoint)
- RequestsLibrary().create_session("so", endpoint, auth=auth)
- headers = self.reqs.create_headers(accept=accept)
- resp = RequestsLibrary().post_request("so", data_path, data=data, headers=headers)
- logger.info("Received response from so " + resp.text)
- return resp
-
- def put_request(self, endpoint, data_path, data, accept="application/json", auth=None):
- """Runs an SO post request"""
- logger.info("Creating session" + endpoint)
- RequestsLibrary().create_session("so", endpoint, auth=auth)
- headers = self.reqs.create_headers(accept=accept)
- resp = RequestsLibrary().put_request("so", data_path, data=data, headers=headers)
- logger.info("Received response from so " + resp.text)
- return resp
-
- def delete_request(self, endpoint, data_path, data, accept="application/json", auth=None):
- """Runs an SO post request"""
- logger.info("Creating session" + endpoint)
- RequestsLibrary().create_session("so", endpoint, auth=auth)
- headers = self.reqs.create_headers(accept=accept)
- resp = RequestsLibrary().delete_request("so", data_path, data=data, headers=headers)
- logger.info("Received response from so " + resp.text)
- return resp
+ return self.reqs.put_request("so", endpoint, data_path, data, accept, auth)