MT#58762 adjust restpi tests to harmonized wildcard filters

Change-Id: I68b2199a3487fedb388803012c950c3abca1a8b3
(cherry picked from commit aa2d07ef29)
mr11.5.1
Rene Krenn 1 year ago committed by Marco Capetta
parent 5b62ba15f3
commit 5f070d0fd8

@ -40,7 +40,7 @@ sub query_params {
second => sub { },
},
},
YYYY{
{
param => 'folder',
description => 'Filter for voicemails in a specific folder (one of INBOX, Old, Friends, Family, Cust1 to Cust4)',
query => {

@ -12,7 +12,7 @@ my$test_collection = new Test::Collection(
DEBUG => 1,
);
$test_collection->DEBUG_ONLY(0);
my $profiles = $test_collection->get_collection_hal('pbxdeviceprofiles','/api/pbxdeviceprofiles/?name='.uri_escape('%two%'));
my $profiles = $test_collection->get_collection_hal('pbxdeviceprofiles','/api/pbxdeviceprofiles/?name='.uri_escape('*two*'));
$test_collection->DEBUG_ONLY(1);
if($profiles && $profiles->{total_count}){
foreach my $profile(@{$profiles->{collection}}){
@ -27,7 +27,7 @@ if($profiles && $profiles->{total_count}){
$test_collection->name('pbxdevicemodels');
$test_collection->DEBUG_ONLY(0);
my $models = $test_collection->get_collection_hal('pbxdevicemodels','/api/pbxdevicemodels/?model='.uri_escape('%two%'));
my $models = $test_collection->get_collection_hal('pbxdevicemodels','/api/pbxdevicemodels/?model='.uri_escape('*two*'));
$test_collection->DEBUG_ONLY(1);
if($models && $models->{total_count}){
foreach my $model(@{$models->{collection}}){

@ -171,7 +171,7 @@ done_testing;
sub _filter_by_ip {
my ($ip,$expected,$version) = @_;
$req = HTTP::Request->new('GET', $uri.'/api/billingnetworks/?page=1&rows=5&ip='.$ip.'&name='.URI::Escape::uri_escape('%').$t);
$req = HTTP::Request->new('GET', $uri.'/api/billingnetworks/?page=1&rows=5&ip='.$ip.'&name='.URI::Escape::uri_escape('*').$t);
$res = $ua->request($req);
is($res->code, 200, "filter for $version ip ".$ip);
my $collection = JSON::from_json($res->decoded_content);

@ -189,7 +189,7 @@ my %package_map = ();
push(@profile_packages,_post_profile_package());
}
$req = HTTP::Request->new('GET', $uri.'/api/profilepackages/?page=1&rows=5&network_name='.URI::Escape::uri_escape('%')."network $t");
$req = HTTP::Request->new('GET', $uri.'/api/profilepackages/?page=1&rows=5&network_name='.URI::Escape::uri_escape('*')."network $t");
$res = $ua->request($req);
is($res->code, 200, "filter packages by network name");
my $collection = JSON::from_json($res->decoded_content);

@ -58,10 +58,10 @@ ok($filtered_by_reseller_correct->{total_count} > 0,"check that found soundsets
my $filtered_by_reseller_wrong = $test_machine->get_collection_hal('soundsets', '/api/soundsets?reseller_id=9999999');
ok(!$filtered_by_reseller_wrong->{total_count},"check that not found soundsets of wrong reseller_id");
my $filtered_by_name_correct = $test_machine->get_collection_hal('soundsets', '/api/soundsets?name=api_test%25');
my $filtered_by_name_correct = $test_machine->get_collection_hal('soundsets', '/api/soundsets?name=api_test*');
ok($filtered_by_name_correct->{total_count} > 0,"check that found soundsets of name");
my $filtered_by_name_wrong = $test_machine->get_collection_hal('soundsets', '/api/soundsets?name=api_test');
my $filtered_by_name_wrong = $test_machine->get_collection_hal('soundsets', '/api/soundsets?name=x');
ok(!$filtered_by_name_wrong->{total_count},"check that not found soundsets of wrong name");
$test_machine->clear_test_data_all();

Loading…
Cancel
Save