|
|
|
@ -208,6 +208,11 @@ has 'ROWS' =>(
|
|
|
|
|
isa => 'Str',
|
|
|
|
|
default => '1',
|
|
|
|
|
);
|
|
|
|
|
has 'NO_COUNT' =>(
|
|
|
|
|
is => 'rw',
|
|
|
|
|
isa => 'Str',
|
|
|
|
|
default => '',
|
|
|
|
|
);
|
|
|
|
|
has 'URI_CUSTOM_STORE' =>(
|
|
|
|
|
is => 'rw',
|
|
|
|
|
isa => 'Str',
|
|
|
|
@ -461,7 +466,7 @@ sub get_uri_collection{
|
|
|
|
|
sub get_uri_collection_paged{
|
|
|
|
|
my($self,$name) = @_;
|
|
|
|
|
my $uri = $self->get_uri_collection($name);
|
|
|
|
|
return $uri.($uri !~/\?/ ? '?':'&').'page='.($self->PAGE // '1').'&rows='.($self->ROWS // '1');
|
|
|
|
|
return $uri.($uri !~/\?/ ? '?':'&').'page='.($self->PAGE // '1').'&rows='.($self->ROWS // '1').($self->NO_COUNT ? '&no_count=1' : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub get_uri_get{
|
|
|
|
@ -917,7 +922,9 @@ sub check_list_collection{
|
|
|
|
|
$nexturi = $sub_sort_params->($nexturi);
|
|
|
|
|
is($selfuri, $nexturi, $test_info_prefix."check _links.self.href of collection");
|
|
|
|
|
my $colluri = URI->new($selfuri);
|
|
|
|
|
if(($list_collection->{total_count} && $list_collection->{total_count} > 0 ) || !$self->ALLOW_EMPTY_COLLECTION){
|
|
|
|
|
if(
|
|
|
|
|
((!$self->NO_COUNT) && $list_collection->{total_count} && is_int($list_collection->{total_count}) && $list_collection->{total_count} > 0 )
|
|
|
|
|
|| !$self->ALLOW_EMPTY_COLLECTION){
|
|
|
|
|
ok($list_collection->{total_count} > 0, $test_info_prefix."check 'total_count' of collection");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -931,10 +938,12 @@ sub check_list_collection{
|
|
|
|
|
} else {
|
|
|
|
|
ok(exists $list_collection->{_links}->{prev}->{href}, $test_info_prefix."check existence of 'prev'");
|
|
|
|
|
}
|
|
|
|
|
if(($rows != 0) && ($list_collection->{total_count} / $rows) <= $page) {
|
|
|
|
|
ok(!exists $list_collection->{_links}->{next}->{href}, $test_info_prefix."check absence of 'next' on last page");
|
|
|
|
|
} else {
|
|
|
|
|
ok(exists $list_collection->{_links}->{next}->{href}, $test_info_prefix."check existence of 'next'");
|
|
|
|
|
if (!$self->NO_COUNT) {
|
|
|
|
|
if(($rows != 0) && ($list_collection->{total_count} / $rows) <= $page) {
|
|
|
|
|
ok(!exists $list_collection->{_links}->{next}->{href}, $test_info_prefix."check absence of 'next' on last page");
|
|
|
|
|
} else {
|
|
|
|
|
ok(exists $list_collection->{_links}->{next}->{href}, $test_info_prefix."check existence of 'next'");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($list_collection->{_links}->{next}->{href}) {
|
|
|
|
@ -944,7 +953,7 @@ sub check_list_collection{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
my $hal_name = $self->get_hal_name;
|
|
|
|
|
if(($list_collection->{total_count} && $list_collection->{total_count} > 0 ) || !$self->ALLOW_EMPTY_COLLECTION){
|
|
|
|
|
if(($list_collection->{total_count} && is_int($list_collection->{total_count}) && $list_collection->{total_count} > 0 ) || !$self->ALLOW_EMPTY_COLLECTION){
|
|
|
|
|
if (! ok(((ref $list_collection->{_links}->{$hal_name} eq "ARRAY" ) ||
|
|
|
|
|
(ref $list_collection->{_links}->{$hal_name} eq "HASH" ) ), $test_info_prefix."check if 'ngcp:".$self->name."' is array/hash-ref")) {
|
|
|
|
|
diag($list_collection->{_links}->{$hal_name});
|
|
|
|
@ -1167,6 +1176,9 @@ sub check_bundle{
|
|
|
|
|
if($self->methods->{collection}->{allowed}->{GET}){
|
|
|
|
|
$listed = $self->check_list_collection();
|
|
|
|
|
$self->check_created_listed($listed);
|
|
|
|
|
$self->NO_COUNT('1');
|
|
|
|
|
$self->check_list_collection();
|
|
|
|
|
$self->NO_COUNT('');
|
|
|
|
|
}
|
|
|
|
|
# test model item
|
|
|
|
|
if(@$listed && !$self->NO_ITEM_MODULE){
|
|
|
|
@ -1533,5 +1545,11 @@ sub clear_cache{
|
|
|
|
|
`$cmd`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub is_int {
|
|
|
|
|
my $val = shift;
|
|
|
|
|
if($val =~ /^[+-]?[0-9]+$/) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
1;
|
|
|
|
|