X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fecs_api_functions.sh;h=dfa6e4b88e955b573f96b863af3eacbd7268ecac;hb=2d7ba05327959f5381f96fd885b3b82789d8936c;hp=6c726b9c669483b18c2b458b6736cc9908189bbf;hpb=b5cb68ea0e77d0a1421b4f17cc58b981628c29f7;p=nonrtric.git diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index 6c726b9c..dfa6e4b8 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -143,16 +143,16 @@ ecs_api_a1_get_type() { return 0 } -# API Test function: GET ​/A1-EI​/v1​/eitypes -# args: (EMPTY | []+) +# API Test function: GET /A1-EI/v1/eitypes +# args: [ (EMPTY | []+) ] # (Function for test scripts) ecs_api_a1_get_type_ids() { echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG ((RES_TEST++)) - if [ $# -lt 2 ]; then - __print_err " (EMPTY | []+)" $@ + if [ $# -lt 1 ]; then + __print_err " [ (EMPTY | []+) ]" $@ return 1 fi @@ -166,25 +166,27 @@ ecs_api_a1_get_type_ids() { __check_stop_at_error return 1 fi - body=${res:0:${#res}-3} - targetJson="[" - if [ $2 != "EMPTY" ]; then - for pid in ${@:2} ; do - if [ "$targetJson" != "[" ]; then - targetJson=$targetJson"," - fi - targetJson=$targetJson"\"$pid\"" - done - fi - targetJson=$targetJson"]" - echo " TARGET JSON: $targetJson" >> $HTTPLOG - res=$(python3 ../common/compare_json.py "$targetJson" "$body") + if [ $# -gt 1 ]; then + body=${res:0:${#res}-3} + targetJson="[" + if [ $2 != "EMPTY" ]; then + for pid in ${@:2} ; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + targetJson=$targetJson"\"$pid\"" + done + fi + targetJson=$targetJson"]" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") - if [ $res -ne 0 ]; then - echo -e $RED" FAIL, returned body not correct"$ERED - ((RES_FAIL++)) - __check_stop_at_error - return 1 + if [ $res -ne 0 ]; then + echo -e $RED" FAIL, returned body not correct"$ERED + ((RES_FAIL++)) + __check_stop_at_error + return 1 + fi fi ((RES_PASS++)) @@ -425,7 +427,7 @@ ecs_api_edp_get_producer_status() { ((RES_TEST++)) if [ $# -lt 2 ] || [ $# -gt 3 ]; then - __print_err " " $@ + __print_err " []" $@ return 1 fi @@ -514,7 +516,7 @@ ecs_api_edp_get_producer_ids() { } # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId} -# args: [ (NOID | []+)] +# args: [ (EMPTY | []+)] # (Function for test scripts) ecs_api_edp_get_type() { echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD @@ -529,7 +531,7 @@ ecs_api_edp_get_type() { paramError=0 fi if [ $paramError -ne 0 ]; then - __print_err " [ NOID | ([]+)]" $@ + __print_err " [ 'EMPTY' | ([]+)]" $@ return 1 fi