Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 14; |
20 |
use Test::More tests => 13; |
21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
22 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 51-64
my $unauth_password = 'thePassword123';
Link Here
|
51 |
$patron->set_password({ password => $unauth_password, skip_validation => 1 }); |
51 |
$patron->set_password({ password => $unauth_password, skip_validation => 1 }); |
52 |
my $unauth_userid = $patron->userid; |
52 |
my $unauth_userid = $patron->userid; |
53 |
|
53 |
|
54 |
my $fund1 = { |
54 |
my $fund_name = 'Periodiques'; |
55 |
budget_code => 'ABCD', |
55 |
|
56 |
budget_amount => '123.132000', |
56 |
my $fund = $builder->build_object( |
57 |
budget_name => 'Periodiques', |
57 |
{ |
58 |
budget_notes => 'This is a note', |
58 |
class => 'Koha::Acquisition::Funds', |
59 |
}; |
59 |
value => { |
60 |
my $budget_id = AddBudget($fund1); |
60 |
budget_amount => '123.132000', |
61 |
isnt( $budget_id, undef, 'AddBudget does not returns undef' ); |
61 |
budget_name => $fund_name, |
|
|
62 |
budget_notes => 'This is a note' |
63 |
} |
64 |
} |
65 |
); |
62 |
|
66 |
|
63 |
$t->get_ok('/api/v1/acquisitions/funds') |
67 |
$t->get_ok('/api/v1/acquisitions/funds') |
64 |
->status_is(401); |
68 |
->status_is(401); |
Lines 69-83
$t->get_ok('/api/v1/acquisitions/funds/?name=testFund')
Link Here
|
69 |
$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds") |
73 |
$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds") |
70 |
->status_is(403); |
74 |
->status_is(403); |
71 |
|
75 |
|
72 |
$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds/?name=" . $fund1->{ budget_name }) |
76 |
$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds?name=" . $fund_name) |
73 |
->status_is(403); |
77 |
->status_is(403); |
74 |
|
78 |
|
75 |
$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds") |
79 |
$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds") |
76 |
->status_is(200); |
80 |
->status_is(200); |
77 |
|
81 |
|
78 |
$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds/?name=" . $fund1->{ budget_name }) |
82 |
$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds?name=" . $fund_name) |
79 |
->status_is(200) |
83 |
->status_is(200) |
80 |
->json_like('/0/name' => qr/$fund1->{ budget_name }/); |
84 |
->json_like('/0/name' => qr/$fund_name/); |
81 |
|
85 |
|
82 |
$schema->storage->txn_rollback; |
86 |
$schema->storage->txn_rollback; |
83 |
|
87 |
|
84 |
- |
|
|