Lines 39-45
my $t = Test::Mojo->new('Koha::REST::V1');
Link Here
|
39 |
|
39 |
|
40 |
subtest 'list() tests' => sub { |
40 |
subtest 'list() tests' => sub { |
41 |
|
41 |
|
42 |
plan tests => 18; |
42 |
plan tests => 21; |
43 |
|
43 |
|
44 |
# Mock ILLBackend (as object) |
44 |
# Mock ILLBackend (as object) |
45 |
my $backend = Test::MockObject->new; |
45 |
my $backend = Test::MockObject->new; |
Lines 80-86
subtest 'list() tests' => sub {
Link Here
|
80 |
$t->request_ok($tx)->status_is(200)->json_is( [] ); |
80 |
$t->request_ok($tx)->status_is(200)->json_is( [] ); |
81 |
|
81 |
|
82 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
82 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
83 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
83 |
my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
|
84 |
my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); |
84 |
|
85 |
|
85 |
# Create an ILL request |
86 |
# Create an ILL request |
86 |
my $illrequest = $builder->build_object( |
87 |
my $illrequest = $builder->build_object( |
Lines 89-95
subtest 'list() tests' => sub {
Link Here
|
89 |
value => { |
90 |
value => { |
90 |
backend => 'Mock', |
91 |
backend => 'Mock', |
91 |
branchcode => $library->branchcode, |
92 |
branchcode => $library->branchcode, |
92 |
borrowernumber => $patron->borrowernumber |
93 |
borrowernumber => $patron_1->borrowernumber |
93 |
} |
94 |
} |
94 |
} |
95 |
} |
95 |
); |
96 |
); |
Lines 122-128
subtest 'list() tests' => sub {
Link Here
|
122 |
value => { |
123 |
value => { |
123 |
backend => 'Mock', |
124 |
backend => 'Mock', |
124 |
branchcode => $library->branchcode, |
125 |
branchcode => $library->branchcode, |
125 |
borrowernumber => $patron->borrowernumber |
126 |
borrowernumber => $patron_2->borrowernumber |
126 |
} |
127 |
} |
127 |
} |
128 |
} |
128 |
); |
129 |
); |
Lines 146-151
subtest 'list() tests' => sub {
Link Here
|
146 |
[{ path => '/query/request_blah', message => 'Malformed query string'}] |
147 |
[{ path => '/query/request_blah', message => 'Malformed query string'}] |
147 |
); |
148 |
); |
148 |
|
149 |
|
|
|
150 |
# Test the borrowernumber parameter |
151 |
$tx = $t->ua->build_tx( GET => '/api/v1/illrequests?borrowernumber=' . $patron_2->borrowernumber ); |
152 |
$tx->req->cookies( { name => 'CGISESSID', value => $session_id } ); |
153 |
$tx->req->env( { REMOTE_ADDR => $remote_address } ); |
154 |
$t->request_ok($tx)->status_is(200) |
155 |
->json_is( [ $response2 ] ); |
156 |
|
149 |
$schema->storage->txn_rollback; |
157 |
$schema->storage->txn_rollback; |
150 |
}; |
158 |
}; |
151 |
|
159 |
|
152 |
- |
|
|