remove the 200 for sdc too
[testsuite/python-testing-utils.git] / robotframework-onap / ONAPLibrary / BaseSDCKeywords.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 robot.libraries.BuiltIn import BuiltIn
17
18
19 from ONAPLibrary.RequestsHelper import RequestsHelper
20
21
22 class BaseSDCKeywords(object):
23     """The main interface for interacting with SDC. It handles low level stuff like managing the http request library
24     and required fields. """
25
26     def __init__(self):
27         super(BaseSDCKeywords, self).__init__()
28         self.reqs = RequestsHelper()
29         self.builtin = BuiltIn()
30
31     @keyword
32     def run_get_request(self, endpoint, data_path, user, accept="application/json", auth=None):
33         """Runs an SDC get request"""
34         return self.reqs.get_request("sdc", endpoint, data_path, sdc_user=user, accept=accept, auth=auth)
35
36     @keyword
37     def run_post_request(self, endpoint, data_path, data, user, accept="application/json", auth=None):
38         """Runs an SDC post request"""
39         return self.reqs.post_request("sdc", endpoint, data_path, data, user, files=None, accept=accept, auth=auth)
40
41     @keyword
42     def run_post_files_request(self, endpoint, data_path, files, user, accept="application/json", auth=None):
43         """Runs an SDC post files request"""
44         return self.reqs.post_request("sdc", endpoint, data_path, None, user, files=files, accept=accept,
45                                       content_type="multipart/form-data", auth=auth)
46
47     @keyword
48     def run_put_request(self, endpoint, data_path, data, user, accept="application/json", auth=None):
49         """Runs an SDC post request"""
50         return self.reqs.put_request("sdc", endpoint, data_path, data, sdc_user=user, accept=accept, auth=auth)
51
52     @keyword
53     def run_delete_request(self, endpoint, data_path, data, user, accept="application/json", auth=None):
54         """Runs an SDC delete request"""
55         return self.reqs.delete_request("sdc", endpoint, data_path, data, sdc_user=user, accept=accept, auth=auth)