From 1faa2cde90350b22d492ce6c4aa03c661f2ff7a6 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Thu, 19 Nov 2015 13:53:42 +0100 Subject: [PATCH] MT#16323 Fix api-rest/api-calllists.t: skip checking field rating_status if no CDRs exist Otherwise we are getting error: > not ok 10 - Check existence of rating_status field > > # Failed test 'Check existence of rating_status field' > # at t/api-rest/api-calllists.t line 50. > # Total number of calls: 0 Change-Id: I257e198b740363d5d25d6d35a29a482f966377fb --- t/api-rest/api-calllists.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/api-rest/api-calllists.t b/t/api-rest/api-calllists.t index a1c77be466..923cca17a6 100644 --- a/t/api-rest/api-calllists.t +++ b/t/api-rest/api-calllists.t @@ -47,8 +47,12 @@ SKIP: ok( ($cl_collection_ok->{total_count} + $cl_collection_nok->{total_count} ) == $cl_collection->{total_count}, "Rated and not rated calls should be equal to total number of calls"); my($call_hal) = $test_machine->get_hal_from_collection($cl_collection); - ok(exists $call_hal->{rating_status}, - "Check existence of rating_status field"); + + if ( $cl_collection->{total_count} < 1 ) { + ok(1, "Skip checking existence of rating_status field"); + } else { + ok(exists $call_hal->{rating_status}, "Check existence of rating_status field"); + } #/---