From 4c8dc6a28644cbd44084296907d54c66b447432e Mon Sep 17 00:00:00 2001 From: DR695H Date: Fri, 19 Jul 2019 16:55:55 -0400 Subject: fixing is not none Issue-ID: TEST-174 Change-Id: I1b48d6f6839cdbb4df5eb6461ac1a053fcdfbc57 Signed-off-by: DR695H --- robotframework-onap/ONAPLibrary/Base64Keywords.py | 4 ++-- robotframework-onap/ONAPLibrary/BaseSDCKeywords.py | 2 +- robotframework-onap/ONAPLibrary/RequestsHelper.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'robotframework-onap/ONAPLibrary') diff --git a/robotframework-onap/ONAPLibrary/Base64Keywords.py b/robotframework-onap/ONAPLibrary/Base64Keywords.py index a87a4b9..11cc69c 100644 --- a/robotframework-onap/ONAPLibrary/Base64Keywords.py +++ b/robotframework-onap/ONAPLibrary/Base64Keywords.py @@ -11,9 +11,9 @@ class Base64Keywords(object): @keyword def base64_encode(self, string_to_encode): """generate a base64 encoded string""" - return base64.b64encode(self, string_to_encode) + return base64.b64encode(string_to_encode.encode("utf-8")) @keyword def base64_decode(self, string_to_decode): """decode a base64 encoded string""" - return base64.b64decode(self, string_to_decode) + return base64.b64decode(string_to_decode.encode("utf-8")) diff --git a/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py b/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py index de53dd1..19890ae 100644 --- a/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py +++ b/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py @@ -43,7 +43,7 @@ class BaseSDCKeywords(object): @keyword def run_post_files_request(self, endpoint, data_path, files, user, accept="application/json", auth=None): """Runs an SDC post files request""" - return self.reqs.post_request("sdc", endpoint, data_path, files, user, files=None, accept=accept, + return self.reqs.post_request("sdc", endpoint, data_path, None, user, files=files, accept=accept, content_type="multipart/form-data", auth=auth) @keyword diff --git a/robotframework-onap/ONAPLibrary/RequestsHelper.py b/robotframework-onap/ONAPLibrary/RequestsHelper.py index 9de2260..0fd0115 100644 --- a/robotframework-onap/ONAPLibrary/RequestsHelper.py +++ b/robotframework-onap/ONAPLibrary/RequestsHelper.py @@ -37,9 +37,9 @@ class RequestsHelper(object): "X-TransactionId": self.application_id + "-" + uuid, "X-FromAppId": self.application_id } - if not sdc_user_id: + if sdc_user_id is not None: headers["USER_ID"] = sdc_user_id - if not md5: + if md5 is not None: headers["Content-MD5"] = md5 return headers @@ -56,7 +56,7 @@ class RequestsHelper(object): content_type="application/json", auth=None): """Runs a post request""" logger.info("Creating session" + endpoint) - if not data: + if data is not None: md5 = hashlib.md5() md5.update(data) md5checksum = Base64Keywords().base64_encode(md5.hexdigest()) -- cgit 1.2.3-korg