diff options
author | 2019-09-12 21:53:53 +0000 | |
---|---|---|
committer | 2019-09-12 21:53:53 +0000 | |
commit | 35bd320eef94530841bde17e15c3056846c3f3ab (patch) | |
tree | 801b0dcf6c1b2ace5db44979496c2a863b9104c7 /tests/so/orchestration/resources/json_templater.robot | |
parent | cb5be2a649e50ed9e7cd55867a76ca9de2d6630d (diff) | |
parent | 6f09e1be817c52ce3685f94a938ee3180525aad9 (diff) |
Merge "Add orchestration project to SO integration testing repository"
Diffstat (limited to 'tests/so/orchestration/resources/json_templater.robot')
-rw-r--r-- | tests/so/orchestration/resources/json_templater.robot | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/so/orchestration/resources/json_templater.robot b/tests/so/orchestration/resources/json_templater.robot new file mode 100644 index 00000000..0dd88b90 --- /dev/null +++ b/tests/so/orchestration/resources/json_templater.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation This resource is filling out json string templates and returning the json back +Library RequestsLibrary +Library StringTemplater +Library OperatingSystem +Library CSVLibrary +Library Collections +Resource global_properties.robot + +*** Keywords *** +Fill JSON Template + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json} ${arguments} + ${returned_string}= Template String ${json} ${arguments} + Log ${returned_string} + ${returned_json}= To Json ${returned_string} + [Return] ${returned_json} + +Fill JSON Template File + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json_file} ${arguments} + ${json}= OperatingSystem.Get File ${json_file} + ${returned_json}= Fill JSON Template ${json} ${arguments} + [Return] ${returned_json} + +Read CSV Data And Create Dictionary + [Documentation] Read CSV Data And Create Dictionary + [Arguments] ${file} + + ${status} Run Keyword And Return Status Variable Should Exist ${file} + ${csv_file} = set variable if ${status}==True ${file} + LOG ${csv_file} + ${dictionary} Create Dictionary + ${dictionary_list} read csv file to associative ${csv_file} + + ${dict_count} Get Length ${dictionary_list} + : FOR ${row_num} IN RANGE 0 ${dict_count} + \ Log ${dictionary_list[${row_num}]} + \ ${dict_key} Get From Dictionary ${dictionary_list[${row_num}]} uniqueKey + \ Set To Dictionary ${dictionary} ${dict_key} ${dictionary_list[${row_num}]} + + [Return] ${dictionary}
\ No newline at end of file |