From 0605e351036d386b9ca7282dee848b0ce1848274 Mon Sep 17 00:00:00 2001 From: DR695H Date: Fri, 26 Jul 2019 15:56:10 -0400 Subject: [PATCH] remove the 200 for sdc too Issue-ID: TEST-174 Change-Id: I617b1efd11867b13e318387c49c29030c27bbe49 Signed-off-by: DR695H --- robotframework-onap/ONAPLibrary/BaseSDCKeywords.py | 4 +--- .../ONAPLibrary/PreloadDataKeywords.py | 2 ++ robotframework-onap/ONAPLibrary/Utilities.py | 4 +--- .../{VariableKeywords.py => VariableHelper.py} | 22 ++++++++++++++-------- 4 files changed, 18 insertions(+), 14 deletions(-) rename robotframework-onap/ONAPLibrary/{VariableKeywords.py => VariableHelper.py} (63%) diff --git a/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py b/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py index f3b93af..6f71078 100644 --- a/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py +++ b/robotframework-onap/ONAPLibrary/BaseSDCKeywords.py @@ -31,9 +31,7 @@ class BaseSDCKeywords(object): @keyword def run_get_request(self, endpoint, data_path, user, accept="application/json", auth=None): """Runs an SDC get request""" - resp = self.reqs.get_request("sdc", endpoint, data_path, sdc_user=user, accept=accept, auth=auth) - self.builtin.should_be_equal_as_strings(resp.status_code, "200") - return resp + return self.reqs.get_request("sdc", endpoint, data_path, sdc_user=user, accept=accept, auth=auth) @keyword def run_post_request(self, endpoint, data_path, data, user, accept="application/json", auth=None): diff --git a/robotframework-onap/ONAPLibrary/PreloadDataKeywords.py b/robotframework-onap/ONAPLibrary/PreloadDataKeywords.py index cc16147..87d327b 100644 --- a/robotframework-onap/ONAPLibrary/PreloadDataKeywords.py +++ b/robotframework-onap/ONAPLibrary/PreloadDataKeywords.py @@ -14,6 +14,7 @@ from robot import utils from robot.api.deco import keyword +from robot.libraries.BuiltIn import BuiltIn import os.path import json @@ -25,6 +26,7 @@ class PreloadDataKeywords(object): def __init__(self): super(PreloadDataKeywords, self).__init__() self._cache = utils.ConnectionCache('No Preload Data directories loaded') + self.builtin = BuiltIn() @keyword def set_directory(self, alias, preload_data_directory): diff --git a/robotframework-onap/ONAPLibrary/Utilities.py b/robotframework-onap/ONAPLibrary/Utilities.py index 4773432..5751e21 100644 --- a/robotframework-onap/ONAPLibrary/Utilities.py +++ b/robotframework-onap/ONAPLibrary/Utilities.py @@ -18,7 +18,6 @@ from ONAPLibrary.SocketKeywords import SocketKeywords from ONAPLibrary.UUIDKeywords import UUIDKeywords from ONAPLibrary.HTTPKeywords import HTTPKeywords from ONAPLibrary.Base64Keywords import Base64Keywords -from ONAPLibrary.VariableKeywords import VariableKeywords class Utilities(HybridCore): @@ -32,7 +31,6 @@ class Utilities(HybridCore): SocketKeywords(), UUIDKeywords(), HTTPKeywords(), - Base64Keywords(), - VariableKeywords() + Base64Keywords() ] HybridCore.__init__(self, self.keyword_implementors) diff --git a/robotframework-onap/ONAPLibrary/VariableKeywords.py b/robotframework-onap/ONAPLibrary/VariableHelper.py similarity index 63% rename from robotframework-onap/ONAPLibrary/VariableKeywords.py rename to robotframework-onap/ONAPLibrary/VariableHelper.py index 7b659c2..4a0b819 100644 --- a/robotframework-onap/ONAPLibrary/VariableKeywords.py +++ b/robotframework-onap/ONAPLibrary/VariableHelper.py @@ -12,24 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -from robot.api.deco import keyword from robot.libraries.BuiltIn import BuiltIn -class VariableKeywords(object): - """ Utilities useful for working with varaibles """ +class VariableHelper(object): + """ Non keyword class for useful for working with varaibles """ def __init__(self): - super(VariableKeywords, self).__init__() + super(VariableHelper, self).__init__() self.builtin = BuiltIn() - @keyword def get_globally_injected_parameters(self): dictionary = self.builtin.get_variables(no_decoration=True) - return self.filter_variables_by_key_prefix(dictionary, "GLOBAL_INJECTED") + return self.filter_variables_by_key_prefix(dictionary, "GLOBAL_INJECTED_") - @keyword - def filter_variables_by_key_prefix(self, dictionary, partial): + def get_global_parameters(self): + dictionary = self.builtin.get_variables(no_decoration=True) + global_variables = self.filter_variables_by_key_prefix(dictionary, "GLOBAL_") + # strip out global injected (get those above) + for key in self.get_globally_injected_parameters(): + del global_variables[key] + return global_variables + + @staticmethod + def filter_variables_by_key_prefix(dictionary, partial): matches = dict() for key, val in dictionary.items(): if key.startswith(partial): -- 2.16.6