Update INFO.yaml with new PTL
[testsuite/python-testing-utils.git] / robotframework-onap / ONAPLibrary / BaseCLAMPKeywords.py
1 # Copyright 2019 AT&T Intellectual Property. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from robot.api.deco import keyword
16 from ONAPLibrary.RequestsHelper import RequestsHelper
17
18
19 class BaseCLAMPKeywords(object):
20     """The main interface for interacting with CLAMP. It handles low level stuff like managing the http request library
21     and required fields. """
22
23     def __init__(self):
24         super(BaseCLAMPKeywords, self).__init__()
25         self.reqs = RequestsHelper()
26
27     @keyword
28     def run_get_request(self, endpoint, data_path, accept="application/json", auth=None):
29         """Runs an CLAMP get request"""
30         return self.reqs.get_request(alias="clamp", endpoint=endpoint, data_path=data_path, accept=accept, auth=auth)
31
32     @keyword
33     def run_post_request(self, endpoint, data_path, data, accept="application/json", auth=None):
34         """Runs an CLAMP post request"""
35         return self.reqs.post_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,
36                                       auth=auth)
37
38     @keyword
39     def run_put_request(self, endpoint, data_path, data, accept="application/json", auth=None):
40         """Runs an CLAMP post request"""
41         return self.reqs.put_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,
42                                      auth=auth)
43
44     @keyword
45     def run_delete_request(self, endpoint, data_path, data, accept="application/json", auth=None):
46         """Runs an CLAMP delete request"""
47         return self.reqs.delete_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,
48                                         auth=auth)