From 58e23af59ed0004784461a69f98e8684a1e8e8da Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 22 May 2025 13:45:28 +0000 Subject: [PATCH] Bug 39970: Add tests Test plan: 1) Apply this test patch. Run. Verify it fails 2) Apply other patch. Run. Verify it passes. prove t/db_dependent/api/v1/patrons.t Verify no other regressions are introduced, run: prove t/db_dependent/Koha/Patron/Attribute.t Signed-off-by: David Nind Signed-off-by: Nick Clemens --- t/db_dependent/api/v1/patrons.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index 6ca12dd0531..4441725386d 100755 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -926,7 +926,7 @@ subtest 'update() tests' => sub { subtest "extended_attributes tests" => sub { - plan tests => 26; + plan tests => 29; my $attr_type_repeatable = $builder->build_object( { @@ -968,6 +968,19 @@ subtest 'update() tests' => sub { { type => $deleted_attr_code, value => 'potato' }, ]; + $t->post_ok( + "//$userid:$password@/api/v1/patrons" => json => { + "firstname" => "Katrina", + "surname" => "Fischer", + "address" => "Somewhere", + "category_id" => "ST", + "city" => "Konstanz", + "library_id" => "MPL" + } + )->status_is(400) + ->json_is( + '/error' => "Missing mandatory extended attribute (type=" . $attr_type_mandatory->code . ")" ); + $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $superlibrarian->borrowernumber => { 'x-koha-embed' => 'extended_attributes' } => json => $newpatron )->status_is(400) -- 2.39.5