TT#32203 Fix voicemailgreetings filters

Change-Id: Ibca07c82732d84b911e0c469258edcd9a7848b0a
(cherry picked from commit 09eba509bd)
changes/19/19719/1
Irina Peshinskaya 7 years ago
parent 4e70eee3b3
commit 9173c6eee6

@ -43,10 +43,8 @@ sub query_params {
my $c = shift;
my %wheres = ();
if( $c->config->{features}->{multidomain}) {
$wheres{'domain.id'} = { -ident => 'subscriber.domain_id' };
$wheres{'domain.id'} = { -ident => 'voip_subscriber.domain_id' };
}
my $h =
return {
'voip_subscriber.id' => $q,
%wheres,
@ -55,12 +53,12 @@ sub query_params {
second => sub {
my $q = shift;
my $c = shift;
my @joins = ();
my $subscriber_join = 'voip_subscriber';
if( $c->config->{features}->{multidomain}) {
push @joins, 'domain' ;
$subscriber_join = { 'voip_subscriber' => 'domain' };
}
return {
join => [{ subscriber => 'voip_subscriber' },@joins]
join => [{ 'mailboxuser' => { 'provisioning_voip_subscriber' => $subscriber_join }}]
};
},
},

@ -46,11 +46,15 @@ is($greeting->{content}->{subscriber_id}, $test_machine->DATA_ITEM->{json}->{sub
ok($greeting->{content}->{dir} =~/^(?:unavail|busy)$/, "Check dir after creation.");
is($greeting->{content}->{dir}, $test_machine->DATA_ITEM->{json}->{dir}, "Check dir after creation #2.");
$res = $test_machine->request_get('/api/voicemailgreetings/?subscriber_id='.$greeting->{content}->{subscriber_id}.'&type='.$greeting->{content}->{dir});
$test_machine->http_code_msg(200, "check subscriber_id and type filters", $res);
$res = $test_machine->request_get($greeting->{location}, undef, {
'Accept' => 'audio/x-wav',
});
$test_machine->http_code_msg(200, "check download voicemail greeting", $res);
my $expected_downloaded_name = "voicemail_".$greeting->{content}->{dir}."_".$greeting->{content}->{subscriber_id}.".wav";
is($res->filename, $expected_downloaded_name ,"Check downloaded file name: $expected_downloaded_name .");
ok(length($res->content)>0,"Check length of the downloaded file > 0 :".length($res->content));
@ -98,19 +102,13 @@ if(ok($soxi_output =~/GSM/, "Check that we converted wav to GSM encoding:".$soxi
greetingfile => [ dirname($0).'/resources/empty.wav' ],
} );
$test_machine->http_code_msg(422, "check response code on put empty file", $res_put_empty, $content_put_empty);
diag("Check dirty file:");
#btw - other vriant of tha put data - closer to stored. will be changed by Collection::encode_content
($res_put_empty,$content_put_empty) = $test_machine->request_put( {
%{$test_machine->DATA_ITEM_STORE},
greetingfile => [ dirname($0).'/resources/empty.wav' ],
} );
$test_machine->http_code_msg(422, "check response code on put empty file", $res_put_empty, $content_put_empty);
}
$test_machine->check_bundle();
$test_machine->check_item_delete($greeting->{location});
$test_machine->clear_test_data_all();#fake data aren't registered in this test machine, so they will stay.
undef $fake_data;
undef $test_machine;
done_testing;

Loading…
Cancel
Save