From 9816c66a100317d0f3a43d3a21c2d0f9154bfc80 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 8 Mar 2022 15:43:28 -0300 Subject: [PATCH] Bug 30194: (follow-up) Remove invalid tests Content-Type: text/plain; charset="utf-8" This patch removes tests for the wrong 'Accept' header situation. It is the only thing I found I could do. The situation is: the JSON::Validator + Mojolicious::Plugin::OpenAPI is trapping this case and returning its own error code (400) and it also builds its own message! So no point testing it, as it can change again. I post it as a separate patch just in case someone finds a better way to handle this and obsoletes the patch :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Mason James --- t/db_dependent/api/v1/biblios.t | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index 5c836c39d8..ca7a23e1e7 100755 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -45,7 +45,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); subtest 'get() tests' => sub { - plan tests => 22; + plan tests => 21; $schema->storage->txn_begin; @@ -71,12 +71,7 @@ subtest 'get() tests' => sub { $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/weird+format' } ) - ->status_is(406) - ->json_is( [ "application/json", - "application/marcxml+xml", - "application/marc-in-json", - "application/marc", - "text/plain" ] ); + ->status_is(400); $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber => { Accept => 'application/json' } ) @@ -223,7 +218,7 @@ subtest 'delete() tests' => sub { subtest 'get_public() tests' => sub { - plan tests => 26; + plan tests => 25; $schema->storage->txn_begin; @@ -256,11 +251,7 @@ subtest 'get_public() tests' => sub { $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'application/weird+format' } ) - ->status_is(406) - ->json_is( [ "application/marcxml+xml", - "application/marc-in-json", - "application/marc", - "text/plain" ] ); + ->status_is(400); $t->get_ok( "//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } ) -- 2.20.1