diff options
author | DR695H <dr695h@att.com> | 2019-07-11 11:57:29 -0400 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2019-07-11 11:57:29 -0400 |
commit | 335a1c8082c8e7788e56307a9c03a8511500a687 (patch) | |
tree | 6c19adff23737743bac2651ae747db50f982e794 /robotframework-onap/ONAPLibrary/BaseSOKeywords.py | |
parent | 1afa01d5848f9a7a99c436397ebc019cee7fb362 (diff) |
moving basic rest calls to requestshelper
Issue-ID: TEST-173
Change-Id: I76736b52a48510ce0a6f44607401b8e127a87476
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robotframework-onap/ONAPLibrary/BaseSOKeywords.py')
-rw-r--r-- | robotframework-onap/ONAPLibrary/BaseSOKeywords.py | 45 |
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) |