From b914796692075a95cb2012ffd02dcfee948c7b62 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Tue, 5 Mar 2019 21:13:07 +0100 Subject: [PATCH] TT#50907 Make subscriber profiles tests more stable Change-Id: I1905565ae91f8deed1647dd51d22d28f3997bcc3 (cherry picked from commit 32e646eff99ff3641d3f7602c2cdedb45341e03e) --- t/api-rest/api-subscribers.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/api-rest/api-subscribers.t b/t/api-rest/api-subscribers.t index cf8ac3bc3d..3e3357a2a4 100644 --- a/t/api-rest/api-subscribers.t +++ b/t/api-rest/api-subscribers.t @@ -357,6 +357,10 @@ if($remote_config->{config}->{features}->{cloudpbx}){ my $data = clone $test_machine->DATA_ITEM; $data->{administrative} = 1; + $pilot = $test_machine->get_item_hal('subscribers','/api/subscribers/?customer_id='.$data->{customer_id}.'&'.'is_pbx_pilot=1'); + if(!$pilot->{total_count} || $pilot->{total_count} <= 0){ + undef $pilot; + } my $pbxsubscriberadmin = $test_machine->check_create_correct(1, sub { my $num = $_[1]->{i}; $_[0]->{administrative} = 1; @@ -415,10 +419,12 @@ if($remote_config->{config}->{features}->{cloudpbx}){ ($res,$content,$req) = $test_machine->request_patch( [ { op => 'replace', path => '/profile_set_id', value => $wrong_profile_sets->[0]->{content}->{id} } ], $subscriber->{location} ); $test_machine->http_code_msg(422, "Check incorrect profile_set_id patch for administrator", $res, $content); - + + ($res,$content,$req) = $test_machine->request_patch( [ { op => 'replace', path => '/profile_id', value => undef }, { op => 'replace', path => '/profile_set_id', value => undef } ], $subscriber->{location} ); + $test_machine->http_code_msg(200, "Check unset profile_id and profile_set_id patch for administrator", $res, $content); + ($res,$content,$req) = $test_machine->request_patch( [ { op => 'replace', path => '/profile_id', value => $wrong_profiles->[0]->{content}->{id} } ], $subscriber->{location} ); $test_machine->http_code_msg(422, "Check incorrect profile_id patch for administrator", $res, $content); - ($res,$content,$req) = $test_machine->request_patch( [ { op => 'replace', path => '/profile_set_id', value => $wrong_profile_sets->[0]->{content}->{id} } ], $subscriber->{location} ); $test_machine->http_code_msg(422, "Check profile_set_id patch for administrator", $res, $content);