From 7ae2e6bac5cc24737f71df4a9e71e8296115b0a2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 4 Jan 2021 09:59:26 -0300 Subject: [PATCH] Bug 23857: Regression tests Signed-off-by: David Nind --- t/db_dependent/api/v1/clubs_holds.t | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/api/v1/clubs_holds.t b/t/db_dependent/api/v1/clubs_holds.t index 240018f65f..46c5402df5 100755 --- a/t/db_dependent/api/v1/clubs_holds.t +++ b/t/db_dependent/api/v1/clubs_holds.t @@ -58,11 +58,12 @@ subtest 'add() tests' => sub { $schema->storage->txn_rollback; subtest 'librarian access tests' => sub { - plan tests => 8; + plan tests => 9; $schema->storage->txn_begin; my ($club_with_enrollments, $club_without_enrollments, $item, @enrollments) = create_test_data(); + my $club_with_enrollments_id = $club_with_enrollments->id; my ( undef, $session_id ) = create_user_and_session({ authorized => 1 }); my $data = { @@ -81,18 +82,23 @@ subtest 'add() tests' => sub { ->status_is(201, 'Created Hold') ->json_has('/club_hold_id', 'got a club hold id') ->json_is( '/club_id' => $club_with_enrollments->id) - ->json_is( '/biblio_id' => $item->biblionumber); + ->json_is( '/biblio_id' => $item->biblionumber) + ->header_like( + Location => qr|^\/api\/v1\/clubs/$club_with_enrollments_id/holds|, + 'SWAGGER3.4.1' + ); $schema->storage->txn_rollback; }; }; subtest "default patron home" => sub { - plan tests => 8; + plan tests => 9; $schema->storage->txn_begin; my ($club_with_enrollments, $club_without_enrollments, $item, @enrollments) = create_test_data(); + my $club_with_enrollments_id = $club_with_enrollments->id; my ( undef, $session_id ) = create_user_and_session({ authorized => 1 }); my $data = { @@ -104,7 +110,11 @@ subtest "default patron home" => sub { my $tx = $t->ua->build_tx(POST => "/api/v1/clubs/".$club_with_enrollments->id."/holds" => json => $data); $tx->req->cookies({ name => 'CGISESSID', value => $session_id }); $t->request_ok($tx) - ->status_is(201, 'Created Hold'); + ->status_is(201, 'Created Hold') + ->header_like( + Location => qr|^\/api\/v1\/clubs/$club_with_enrollments_id/holds|, + 'SWAGGER3.4.1' + ); my $json_response = decode_json $t->tx->res->content->get_body_chunk; @@ -197,4 +207,4 @@ sub create_test_data { $lib = $builder->build_object({ class => 'Koha::Libraries', value => {pickup_location => 1}}); my $item = $builder->build_sample_item({homebranch => $lib->branchcode}); return ( $club_with_enrollments, $club_without_enrollments, $item, [ $enrollment1, $enrollment2, $enrollment3, $enrollment4, $enrollment5, $enrollment6 ] ); -} \ No newline at end of file +} -- 2.11.0