Bugzilla – Attachment 159881 Details for
Bug 35468
Bookings permission mismatch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35468: (follow-up) Fix for older DateTimes
Bug-35468-follow-up-Fix-for-older-DateTimes.patch (text/plain), 5.40 KB, created by
Martin Renvoize (ashimema)
on 2023-12-15 11:29:02 UTC
(
hide
)
Description:
Bug 35468: (follow-up) Fix for older DateTimes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-12-15 11:29:02 UTC
Size:
5.40 KB
patch
obsolete
>From 2353fc30bfdb93222775e9340f1d4742b720da8e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 15 Dec 2023 11:27:35 +0000 >Subject: [PATCH] Bug 35468: (follow-up) Fix for older DateTimes > >We can't use the rfc3339 method from DateTime itself as older Debians >don't ship with a recent enough version. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/api/v1/bookings.t | 32 +++++++++++++++++--------------- > 1 file changed, 17 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/api/v1/bookings.t b/t/db_dependent/api/v1/bookings.t >index bbaff2ee863..27595afaebb 100755 >--- a/t/db_dependent/api/v1/bookings.t >+++ b/t/db_dependent/api/v1/bookings.t >@@ -27,7 +27,7 @@ use JSON qw(encode_json); > > use Koha::Bookings; > use Koha::Database; >-use Koha::DateUtils qw (dt_from_string); >+use Koha::DateUtils qw (dt_from_string output_pref); > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -86,8 +86,8 @@ subtest 'list() tests' => sub { > $t->get_ok("//$userid:$password@/api/v1/bookings")->status_is(200)->json_is( [ $booking_0->to_api ] ); > > # More bookings >- my $start_1 = dt_from_string->add( days => 1 )->truncate( to => 'day' ); >- my $end_1 = dt_from_string->add( days => 6 )->truncate( to => 'day' ); >+ my $start_1 = dt_from_string->add( days => 1 )->truncate( to => 'day' ); >+ my $end_1 = dt_from_string->add( days => 6 )->truncate( to => 'day' ); > my $booking_1 = $builder->build_object( > { > class => 'Koha::Bookings', >@@ -98,8 +98,8 @@ subtest 'list() tests' => sub { > } > ); > >- my $start_2 = dt_from_string->add( days => 4 )->truncate( to => 'day' ); >- my $end_2 = dt_from_string->add( days => 8 )->truncate( to => 'day' ); >+ my $start_2 = dt_from_string->add( days => 4 )->truncate( to => 'day' ); >+ my $end_2 = dt_from_string->add( days => 8 )->truncate( to => 'day' ); > my $booking_2 = $builder->build_object( > { > class => 'Koha::Bookings', >@@ -121,7 +121,8 @@ subtest 'list() tests' => sub { > ); > > # Filtering works, two bookings after today >- my $api_filter = encode_json( { 'me.start_date' => { '>=' => dt_from_string->rfc3339 } } ); >+ my $api_filter = encode_json( >+ { 'me.start_date' => { '>=' => output_pref( { dateformat => "rfc3339", dt => dt_from_string } ) } } ); > $t->get_ok("//$userid:$password@/api/v1/bookings?q=$api_filter")->status_is(200)->json_is( > '' => [ > $booking_1->to_api, >@@ -130,7 +131,8 @@ subtest 'list() tests' => sub { > 'filtered returns two future bookings' > ); > >- $api_filter = encode_json( { 'me.start_date' => { '<=' => dt_from_string->rfc3339 } } ); >+ $api_filter = encode_json( >+ { 'me.start_date' => { '<=' => output_pref( { dateformat => "rfc3339", dt => dt_from_string } ) } } ); > $t->get_ok("//$userid:$password@/api/v1/bookings?q=$api_filter")->status_is(200) > ->json_is( '' => [ $booking_0->to_api ], 'filtering to before today also works' ); > >@@ -227,8 +229,8 @@ subtest 'add() tests' => sub { > biblio_id => $biblio->id, > item_id => undef, > patron_id => $patron->id, >- start_date => dt_from_string->add( days => 2 )->rfc3339, >- end_date => dt_from_string->add( days => 6 )->rfc3339, >+ start_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 2 ) } ), >+ end_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 6 ) } ), > }; > > # Unauthorized attempt to write >@@ -324,8 +326,8 @@ subtest 'update() tests' => sub { > my $booking_with_missing_field = { > item_id => undef, > patron_id => $patron->id, >- start_date => dt_from_string->add( days => 2 )->rfc3339, >- end_date => dt_from_string->add( days => 6 )->rfc3339, >+ start_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 2 ) } ), >+ end_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 6 ) } ), > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_missing_field ) >@@ -336,8 +338,8 @@ subtest 'update() tests' => sub { > biblio_id => $biblio->id, > item_id => undef, > patron_id => $patron->id, >- start_date => dt_from_string->add( days => 2 )->rfc3339, >- end_date => dt_from_string->add( days => 6 )->rfc3339, >+ start_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 2 ) } ), >+ end_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 6 ) } ), > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_updated_field ) >@@ -349,8 +351,8 @@ subtest 'update() tests' => sub { > biblio_id => $biblio->id, > item_id => undef, > patron_id => $patron->id, >- start_date => dt_from_string->add( days => 2 )->rfc3339, >- end_date => dt_from_string->add( days => 6 )->rfc3339, >+ start_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 2 ) } ), >+ end_date => output_pref( { dateformat => "rfc3339", dt => dt_from_string->add( days => 6 ) } ), > }; > > $t->put_ok( "//$userid:$password@/api/v1/bookings/$booking_id" => json => $booking_with_invalid_field ) >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35468
:
159734
|
159746
|
159754
|
159755
|
159756
|
159757
|
159789
|
159790
|
159791
|
159792
|
159793
|
159794
|
159795
|
159796
| 159881