Lines 20-25
use Modern::Perl;
Link Here
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 4; |
21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
22 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
|
|
23 |
use t::lib::Mocks; |
23 |
|
24 |
|
24 |
use DateTime; |
25 |
use DateTime; |
25 |
|
26 |
|
Lines 32-42
use Koha::Biblioitems;
Link Here
|
32 |
use Koha::Items; |
33 |
use Koha::Items; |
33 |
use Koha::Patrons; |
34 |
use Koha::Patrons; |
34 |
|
35 |
|
|
|
36 |
my $schema = Koha::Database->new->schema; |
35 |
my $builder = t::lib::TestBuilder->new(); |
37 |
my $builder = t::lib::TestBuilder->new(); |
36 |
|
38 |
|
37 |
my $dbh = C4::Context->dbh; |
39 |
$schema->storage->txn_begin; |
38 |
$dbh->{AutoCommit} = 0; |
40 |
|
39 |
$dbh->{RaiseError} = 1; |
41 |
# FIXME: sessionStorage defaults to mysql, but it seems to break transaction handling |
|
|
42 |
# this affects the other REST api tests |
43 |
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' ); |
40 |
|
44 |
|
41 |
$ENV{REMOTE_ADDR} = '127.0.0.1'; |
45 |
$ENV{REMOTE_ADDR} = '127.0.0.1'; |
42 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
46 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
Lines 114-119
my $itemnumber = create_item($biblionumber, 'TEST000001');
Link Here
|
114 |
my $biblionumber2 = create_biblio('RESTful Web APIs'); |
118 |
my $biblionumber2 = create_biblio('RESTful Web APIs'); |
115 |
my $itemnumber2 = create_item($biblionumber2, 'TEST000002'); |
119 |
my $itemnumber2 = create_item($biblionumber2, 'TEST000002'); |
116 |
|
120 |
|
|
|
121 |
my $dbh = C4::Context->dbh; |
117 |
$dbh->do('DELETE FROM reserves'); |
122 |
$dbh->do('DELETE FROM reserves'); |
118 |
$dbh->do('DELETE FROM issuingrules'); |
123 |
$dbh->do('DELETE FROM issuingrules'); |
119 |
$dbh->do(q{ |
124 |
$dbh->do(q{ |
Lines 304-311
subtest "Test endpoints with permission" => sub {
Link Here
|
304 |
->json_like('/error', qr/tooManyReserves/); |
309 |
->json_like('/error', qr/tooManyReserves/); |
305 |
}; |
310 |
}; |
306 |
|
311 |
|
307 |
|
312 |
$schema->storage->txn_rollback; |
308 |
$dbh->rollback; |
|
|
309 |
|
313 |
|
310 |
sub create_biblio { |
314 |
sub create_biblio { |
311 |
my ($title) = @_; |
315 |
my ($title) = @_; |