From 0605e351036d386b9ca7282dee848b0ce1848274 Mon Sep 17 00:00:00 2001 From: DR695H Date: Fri, 26 Jul 2019 15:56:10 -0400 Subject: 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 +- robotframework-onap/ONAPLibrary/VariableHelper.py | 43 ++++++++++++++++++++++ .../ONAPLibrary/VariableKeywords.py | 37 ------------------- 5 files changed, 47 insertions(+), 43 deletions(-) create mode 100644 robotframework-onap/ONAPLibrary/VariableHelper.py delete mode 100644 robotframework-onap/ONAPLibrary/VariableKeywords.py 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/VariableHelper.py b/robotframework-onap/ONAPLibrary/VariableHelper.py new file mode 100644 index 0000000..4a0b819 --- /dev/null +++ b/robotframework-onap/ONAPLibrary/VariableHelper.py @@ -0,0 +1,43 @@ +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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 robot.libraries.BuiltIn import BuiltIn + + +class VariableHelper(object): + """ Non keyword class for useful for working with varaibles """ + + def __init__(self): + super(VariableHelper, self).__init__() + self.builtin = BuiltIn() + + def get_globally_injected_parameters(self): + dictionary = self.builtin.get_variables(no_decoration=True) + return self.filter_variables_by_key_prefix(dictionary, "GLOBAL_INJECTED_") + + 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): + matches[key] = val + return matches diff --git a/robotframework-onap/ONAPLibrary/VariableKeywords.py b/robotframework-onap/ONAPLibrary/VariableKeywords.py deleted file mode 100644 index 7b659c2..0000000 --- a/robotframework-onap/ONAPLibrary/VariableKeywords.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2019 AT&T Intellectual Property. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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 robot.api.deco import keyword -from robot.libraries.BuiltIn import BuiltIn - - -class VariableKeywords(object): - """ Utilities useful for working with varaibles """ - - def __init__(self): - super(VariableKeywords, 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") - - @keyword - def filter_variables_by_key_prefix(self, dictionary, partial): - matches = dict() - for key, val in dictionary.items(): - if key.startswith(partial): - matches[key] = val - return matches -- cgit 1.2.3-korg