Update INFO.yaml with new PTL
[testsuite/python-testing-utils.git] / robotframework-onap / ONAPLibrary / RequestSOKeywords.py
index fa32795..671a306 100644 (file)
@@ -11,7 +11,8 @@
 # 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 ONAPLibrary.BaseSOKeywords import BaseSOKeywords
+
+from ONAPLibrary.RequestsHelper import RequestsHelper
 from robot.api import logger
 from robot.api.deco import keyword
 from robot.libraries.BuiltIn import BuiltIn
@@ -23,9 +24,8 @@ class RequestSOKeywords(object):
 
     def __init__(self):
         super(RequestSOKeywords, self).__init__()
-        self.application_id = "robot-ete"
         self.builtin = BuiltIn()
-        self.base_keywords = BaseSOKeywords()
+        self.reqs = RequestsHelper()
 
     @keyword
     def run_polling_get_request(self, endpoint, data_path, complete_states=None, fail_states=None, tries=20,
@@ -37,19 +37,21 @@ class RequestSOKeywords(object):
             complete_states = ["COMPLETE"]
         # do this until it is done
         for i in range(tries):
-            resp = self.base_keywords.get_request(endpoint, data_path, auth=auth)
-            self.builtin.should_not_contain_any(resp.text, fail_states)
+            resp = self.reqs.get_request(alias="so", endpoint=endpoint, data_path=data_path, auth=auth)
             logger.info(resp.json()['request']['requestStatus']['requestState'])
+            if resp.json()['request']['requestStatus']['requestState'] in fail_states:
+                self.builtin.fail("Received failure response from so " + resp.text)
             if resp.json()['request']['requestStatus']['requestState'] in complete_states:
-                logger.info("Received response from so " + resp.text)
-                return resp
+                logger.info("Received complete response from so " + resp.text)
+                return True, resp
             else:
                 self.builtin.sleep(interval, "Response from SO is not in requested status")
+        return False, None
 
     @keyword
-    def run_create_request(self, endpoint, data_path, data, auth):
+    def run_create_request(self, endpoint, data_path, data, auth=None):
         """Runs an SO create request and returns the request id and instance id."""
-        response = self.base_keywords.post_request(endpoint, data_path, data, auth=auth)
+        response = self.reqs.post_request(alias="so", endpoint=endpoint, data_path=data_path, data=data, auth=auth)
         logger.info("Creation request submitted to SO, got response")
 
         req_id = response.get('requestReferences', {}).get('requestId', '')