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/SNIROKeywords.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/SNIROKeywords.py')
-rw-r--r-- | robotframework-onap/ONAPLibrary/SNIROKeywords.py | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/robotframework-onap/ONAPLibrary/SNIROKeywords.py b/robotframework-onap/ONAPLibrary/SNIROKeywords.py index f9750da..34e371d 100644 --- a/robotframework-onap/ONAPLibrary/SNIROKeywords.py +++ b/robotframework-onap/ONAPLibrary/SNIROKeywords.py @@ -11,7 +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 @@ -35,14 +35,14 @@ class SNIROKeywords(object): @keyword def run_sniro_get_request(self, endpoint, data_path, accept="application/json", auth=None): """Runs OOF-SNIRO Get request""" - resp = self.get_request(endpoint, data_path, accept, auth) + resp = self.reqs.get_request("oof-sniro", endpoint, data_path, accept, auth) self.builtin.should_be_equal_as_strings(resp.status_code, "200") return resp @keyword def reset_sniro(self, endpoint): logger.debug('Clearing SNIRO data') - resp = self.post_request(endpoint, '/reset', None) + resp = self.reqs.post_request("oof-sniro", endpoint, '/reset', None) self.builtin.should_be_equal_as_strings(resp.status_code, "200", 'Clearing SNIRO date failed.') @keyword @@ -60,23 +60,6 @@ class SNIROKeywords(object): base64_sniro_data = self.base64.base64_encode(sniro_data) replace_dict = {'base64_sniro_data': base64_sniro_data} sniro_request = self.templating.apply_template("sniro", template_sniro_request, replace_dict) - resp = self.post_request(endpoint, '/', sniro_request) + resp = self.reqs.post_request("oof-sniro", endpoint, '/', sniro_request) self.builtin.should_be_equal_as_strings(resp.status_code, "200", 'SNIRO preloading failed.') return True - - def post_request(self, endpoint, data_path, data, accept="application/json", auth=None): - """Runs an SNIRO 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 get_request(self, endpoint, data_path, accept="application/json", auth=None): - """Runs an SNIRO get request""" - logger.info("Creating session" + endpoint) - RequestsLibrary().create_session("sniro", endpoint, auth=auth) - resp = RequestsLibrary().get_request("sniro", data_path, headers=self.reqs.create_headers(accept=accept)) - logger.info("Received response from OOF-SNIRO " + resp.text) - return resp |