Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / libraries / Utils.robot
index a9e2ae840ad74e73937238aa6147bb937b6b1e6d..17077d466caa6c10a471b7f0a5d0a631a42732d5 100644 (file)
@@ -114,7 +114,9 @@ Check For Specific Number Of Elements At URI
 Log Content
     [Arguments]    ${resp_content}
     IF    '''${resp_content}''' != '${EMPTY}'
-        ${resp_json}=    RequestsLibrary.To Json    ${resp_content}    pretty_print=True
+        ${resp_json}=    BuiltIn.Evaluate
+        ...    json.dumps(json.loads('''${resp_content}'''), sort_keys=True, indent=4, separators=(',', ': '))
+        ...    modules=json
     ELSE
         ${resp_json}=    BuiltIn.Set Variable    ${EMPTY}
     END
@@ -176,7 +178,7 @@ Clean Up Ovs
 Extract Value From Content
     [Documentation]    Will take the given response content and return the value at the given index as a string
     [Arguments]    ${content}    ${index}
-    ${JSON}=    Evaluate    json.loads('''${content}''')    json
+    ${JSON}=    BuiltIn.Evaluate    json.loads('''${content}''')    modules=json
     ${value}=    Set Variable    ${JSON${index}}
     RETURN    ${value}
 
@@ -467,7 +469,11 @@ No Content From URI
     ...    ${headers}. If the request returns a HTTP error, fails. Otherwise
     ...    returns the data obtained by the request.
     [Arguments]    ${session}    ${uri}    ${headers}=${NONE}
-    ${resp}=    RequestsLibrary.Get On Session    ${session}    url=${uri}    expected_status=any    headers=${headers}
+    ${resp}=    RequestsLibrary.Get On Session
+    ...    ${session}
+    ...    url=${uri}
+    ...    headers=${headers}
+    ...    expected_status=anything
     IF    ${resp.status_code} == 404 or ${resp.status_code} == 409    RETURN
     Builtin.Log    ${resp.text}
     Builtin.Fail    The request failed with code ${resp.status_code}