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

(-)a/t/db_dependent/api/v1/items/bundled_items.t (-1 / +48 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/env perl
2
3
use Modern::Perl;
4
5
use Test::More tests => 1;
6
use Test::MockModule;
7
use Test::Mojo;
8
9
use t::lib::TestBuilder;
10
use t::lib::Mocks;
11
12
use Koha::Database;
13
14
my $schema  = Koha::Database->new->schema;
15
my $builder = t::lib::TestBuilder->new;
16
17
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
18
19
my $t = Test::Mojo->new('Koha::REST::V1');
20
21
subtest 'order by me.barcode should return 200' => sub {
22
    plan tests => 2;
23
24
    $schema->storage->txn_begin;
25
26
    my $bundle = $builder->build_sample_item;
27
    my $item   = $builder->build_sample_item;
28
    $bundle->add_to_bundle($item);
29
30
    my $patron = $builder->build_object(
31
        {
32
            class => 'Koha::Patrons',
33
            value => { flags => 4 }
34
        }
35
    );
36
37
    my $password = 'thePassword123';
38
39
    $patron->set_password( { password => $password, skip_validation => 1 } );
40
41
    my $userid = $patron->userid;
42
    my $itemnumber = $bundle->itemnumber;
43
44
    $t->get_ok( "//$userid:$password@/api/v1/items/$itemnumber/bundled_items?_order_by=+me.barcode" )
45
        ->status_is(200);
46
47
    $schema->storage->txn_rollback;
48
};

Return to bug 35963