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 <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit efe048ec66)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Pedro Amorim 2025-05-22 13:45:28 +00:00 committed by Paul Derscheid
parent 9c81bdf529
commit 0a05114dc4
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 14 additions and 1 deletions

View File

@ -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)