Rework of controller car/people cluster suite
[integration/test.git] / csit / libraries / TemplatedRequests.robot
index 9a2657443ac882abae96e203bcafdb68967195d5..992bd9ee3a9b7772bfce83e27f81d2d3806eeccc 100644 (file)
@@ -286,7 +286,7 @@ Verify_Response_Templated
     # TODO: Support for XML-aware comparison could be added, but there are issues with namespaces and similar.
     ${expected_text} =    Resolve_Text_From_Template_Folder    folder=${folder}    base_name=${base_name}    extension=${extension}    mapping=${mapping}    endline=${endline}
     ...    iterations=${iterations}    iter_start=${iter_start}
-    BuiltIn.Run_Keyword_If    ${normalize_json}    Normalize_Jsons_And_Compare    ${expected_text}    ${response}
+    BuiltIn.Run_Keyword_If    ${normalize_json}    Normalize_Jsons_And_Compare    expected_raw=${expected_text}    actual_raw=${response}
     ...    ELSE    BuiltIn.Should_Be_Equal    ${expected_text}    ${response}
 
 Get_From_Uri
@@ -369,7 +369,7 @@ Resolve_Text_From_Template_Folder
     ${separator} =    BuiltIn.Set_Variable_If    '${extension}' != 'json'    ${endline}    ,${endline}
     : FOR    ${iteration}    IN RANGE    ${iter_start}    ${iterations}+${iter_start}
     \    # Add separator only if we are beyond first item.
-    \    BuiltIn.Run_Keyword_If    ${iteration} > 1    Collections.Append_To_List    ${items}    ${separator}
+    \    BuiltIn.Run_Keyword_If    ${iteration} > ${iter_start}    Collections.Append_To_List    ${items}    ${separator}
     \    ${item} =    BuiltIn.Evaluate    string.Template('''${item_template}''').substitute({"i":"${iteration}"})    modules=string
     \    Collections.Append_To_List    ${items}    ${item}
     # TODO: The following makes ugly result for iterations=0. Should we fix that?
@@ -387,10 +387,10 @@ Resolve_Text_From_Template_File
     [Return]    ${final_text}
 
 Normalize_Jsons_And_Compare
-    [Arguments]    ${actual_raw}    ${expected_raw}
+    [Arguments]    ${expected_raw}    ${actual_raw}
     [Documentation]    Use norm_json to normalize both JSON arguments, call Should_Be_Equal.
-    ${actual_normalized} =    norm_json.normalize_json_text    ${actual_raw}
     ${expected_normalized} =    norm_json.normalize_json_text    ${expected_raw}
+    ${actual_normalized} =    norm_json.normalize_json_text    ${actual_raw}
     # Should_Be_Equal shall print nice diff-style line comparison.
     BuiltIn.Should_Be_Equal    ${expected_normalized}    ${actual_normalized}
     # TODO: Add garbage collection? Check whether the temporary data accumulates.