View | Details | Raw Unified | Return to bug 26635
Collapse All | Expand All

(-)a/t/db_dependent/Koha/REST/Plugin/Objects.t (-6 / +18 lines)
Lines 515-521 subtest 'objects.find helper, embed' => sub { Link Here
515
};
515
};
516
516
517
subtest 'objects.find helper with expanded authorised values' => sub {
517
subtest 'objects.find helper with expanded authorised values' => sub {
518
    plan tests => 10;
518
    plan tests => 14;
519
519
520
    $schema->storage->txn_begin;
520
    $schema->storage->txn_begin;
521
521
Lines 602-607 subtest 'objects.find helper with expanded authorised values' => sub { Link Here
602
      ->json_has('/_authorised_values')
602
      ->json_has('/_authorised_values')
603
      ->json_is( '/_authorised_values/country/lib' => $ar->lib );
603
      ->json_is( '/_authorised_values/country/lib' => $ar->lib );
604
604
605
    $t->get_ok( '/cities/' . $manuel->cityid => { 'x-koha-av-expand' => 0 } )
606
      ->status_is(200)->json_is( '/name' => 'Manuel' )
607
      ->json_hasnt('/_authorised_values');
608
605
    $t->get_ok( '/cities/' . $manuela->cityid => { 'x-koha-av-expand' => 1 } )
609
    $t->get_ok( '/cities/' . $manuela->cityid => { 'x-koha-av-expand' => 1 } )
606
      ->status_is(200)->json_is( '/name' => 'Manuela' )
610
      ->status_is(200)->json_is( '/name' => 'Manuela' )
607
      ->json_has('/_authorised_values')
611
      ->json_has('/_authorised_values')
Lines 612-618 subtest 'objects.find helper with expanded authorised values' => sub { Link Here
612
616
613
subtest 'objects.search helper with expanded authorised values' => sub {
617
subtest 'objects.search helper with expanded authorised values' => sub {
614
618
615
    plan tests => 11;
619
    plan tests => 20;
616
620
617
    my $t = Test::Mojo->new;
621
    my $t = Test::Mojo->new;
618
622
Lines 695-706 subtest 'objects.search helper with expanded authorised values' => sub { Link Here
695
    );
699
    );
696
700
697
    $t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' =>
701
    $t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' =>
698
          { 'x-koha-av-expand' => 1 } )->status_is(200)->json_has('/0')
702
          { 'x-koha-av-expand' => 1 } )->status_is(200)
699
      ->json_has('/1')->json_hasnt('/2')->json_is( '/0/name' => 'Manuel' )
703
      ->json_has('/0')->json_has('/1')->json_hasnt('/2')
704
      ->json_is( '/0/name' => 'Manuel' )
700
      ->json_has('/0/_authorised_values')
705
      ->json_has('/0/_authorised_values')
701
      ->json_is( '/0/_authorised_values/country/lib' => $ar->lib )
706
      ->json_is( '/0/_authorised_values/country/lib' => $ar->lib )
702
      ->json_is( '/1/name' => 'Manuela' )->json_has('/1/_authorised_values')
707
      ->json_is( '/1/name' => 'Manuela' )
708
      ->json_has('/1/_authorised_values')
703
      ->json_is( '/1/_authorised_values/country/lib' => $us->lib );
709
      ->json_is( '/1/_authorised_values/country/lib' => $us->lib );
704
710
711
    $t->get_ok( '/cities?name=manuel&_per_page=4&_page=1&_match=starts_with' =>
712
          { 'x-koha-av-expand' => 0 } )->status_is(200)
713
      ->json_has('/0')->json_has('/1')->json_hasnt('/2')
714
      ->json_is( '/0/name' => 'Manuel' )->json_hasnt('/0/_authorised_values')
715
      ->json_is( '/1/name' => 'Manuela' )->json_hasnt('/1/_authorised_values');
716
717
705
    $schema->storage->txn_rollback;
718
    $schema->storage->txn_rollback;
706
};
719
};
707
- 

Return to bug 26635