X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FUtils.robot;h=b30a37a025b9773327cb29e03cf560cb11ff5264;hb=6f361630171308131125ebcc3a99411fdd8285ad;hp=3c13197def3298542eb91e006169e2845149755b;hpb=7f67568b1ce57408a52ec29ba80c28f9c99ca5de;p=integration%2Ftest.git diff --git a/csit/libraries/Utils.robot b/csit/libraries/Utils.robot index 3c13197def..b30a37a025 100644 --- a/csit/libraries/Utils.robot +++ b/csit/libraries/Utils.robot @@ -98,22 +98,31 @@ Check For Specific Number Of Elements At URI Should Be Equal As Strings ${resp.status_code} 200 Should Contain X Times ${resp.content} ${element} ${expected_count} +Log Content + [Arguments] ${resp_content} + ${resp_json} = BuiltIn.Run Keyword If '''${resp_content}''' != '${EMPTY}' RequestsLibrary.To Json ${resp_content} pretty_print=True + ... ELSE BuiltIn.Set Variable ${EMPTY} + BuiltIn.Log ${resp_json} + [Return] ${resp_json} + Check For Elements At URI - [Arguments] ${uri} ${elements} ${session}=session + [Arguments] ${uri} ${elements} ${session}=session ${pretty_print_json}=False [Documentation] A GET is made at the supplied ${URI} and every item in the list of ... ${elements} is verified to exist in the response ${resp} RequestsLibrary.Get Request ${session} ${uri} - Log ${resp.content} + BuiltIn.Run Keyword If "${pretty_print_json}" == "True" Log Content ${resp.content} + ... ELSE BuiltIn.Log ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 : FOR ${i} IN @{elements} \ Should Contain ${resp.content} ${i} Check For Elements Not At URI - [Arguments] ${uri} ${elements} ${session}=session + [Arguments] ${uri} ${elements} ${session}=session ${pretty_print_json}=False [Documentation] A GET is made at the supplied ${URI} and every item in the list of ... ${elements} is verified to NOT exist in the response ${resp} RequestsLibrary.Get Request ${session} ${uri} - Log ${resp.content} + BuiltIn.Run Keyword If "${pretty_print_json}" == "True" Log Content ${resp.content} + ... ELSE BuiltIn.Log ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 : FOR ${i} IN @{elements} \ Should Not Contain ${resp.content} ${i}