Bug 34999: Add unit test

Test plan:
Run t/db_dependent/api/v1/auth.t
[Bonus] Run prove t/db_dependent/api/v1

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b8d9cce664)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2024-01-11 10:09:57 +00:00 committed by Fridolin Somers
parent 24b14de398
commit ce924fa1db
1 changed files with 10 additions and 1 deletions

View File

@ -40,7 +40,7 @@ my $tx;
subtest 'under() tests' => sub {
plan tests => 20;
plan tests => 23;
$schema->storage->txn_begin;
@ -104,6 +104,15 @@ subtest 'under() tests' => sub {
->status_is(503)
->json_is('/error', 'System is under maintenance.');
# 503 (public while maintenance syspref activated)
t::lib::Mocks::mock_preference( 'OPACMaintenance', 1 );
t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 );
$tx = $t->ua->build_tx( GET => "/api/v1/public/libraries" );
$tx->req->env( { REMOTE_ADDR => $remote_address } );
$t->request_ok($tx)->status_is(503)->json_is( '/error', 'Under maintenance' );
t::lib::Mocks::mock_preference( 'OPACMaintenance', 0 );
t::lib::Mocks::mock_preference( 'RESTPublicAPI', 0 );
$schema->storage->txn_rollback;
};