From 09514c55a382710ff3ec90ba0b8e09b6a873c28c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 25 Aug 2022 09:39:10 +0000 Subject: [PATCH] Bug 30242: Add test Content-Type: text/plain; charset=utf-8 Test plan: Run t/db_dependent/Koha/REST/V1.t Signed-off-by: Marcel de Rooy --- t/db_dependent/Koha/REST/V1.t | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/REST/V1.t b/t/db_dependent/Koha/REST/V1.t index fc333a0814..cfc4441e05 100755 --- a/t/db_dependent/Koha/REST/V1.t +++ b/t/db_dependent/Koha/REST/V1.t @@ -17,9 +17,11 @@ use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use Test::Mojo; -use Test::Warn; +#use Test::Warn; + +use t::lib::Mocks; subtest 'Type definition tests' => sub { @@ -40,3 +42,21 @@ subtest 'Type definition tests' => sub { is( $types->type('mij'), 'application/marc-in-json', 'application/marc-in-json is defined' ); is( $types->type('marc'), 'application/marc', 'application/marc is defined' ); }; + +subtest 'check log_level' => sub { + plan tests => 3; + my $test; + + t::lib::Mocks::mock_config( 'mojo_log_level', 'warn' ); + $test = Test::Mojo->new('Koha::REST::V1'); + is( $test->app->log->level, 'warn', 'Log level comes from koha-conf.xml'); + + t::lib::Mocks::mock_config( 'mojo_log_level', undef ); + t::lib::Mocks::mock_config( 'dev_install', 1 ); + $test = Test::Mojo->new('Koha::REST::V1'); + is( $test->app->log->level, 'trace', 'Log level falls back to trace for dev_install'); + + t::lib::Mocks::mock_config( 'dev_install', undef ); + $test = Test::Mojo->new('Koha::REST::V1'); + is( $test->app->log->level, 'info', 'Log level falls back to info otherwise'); +}; -- 2.20.1