Bugzilla – Attachment 126679 Details for
Bug 28585
Cannot search on date fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28585: (QA follow-up) Add explicit tests for setting date/date-time attributes
Bug-28585-QA-follow-up-Add-explicit-tests-for-sett.patch (text/plain), 3.92 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-21 18:36:06 UTC
(
hide
)
Description:
Bug 28585: (QA follow-up) Add explicit tests for setting date/date-time attributes
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-21 18:36:06 UTC
Size:
3.92 KB
patch
obsolete
>From 2447a7c04de653bf5d28a08579bd35ee9f804c67 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 21 Oct 2021 15:33:54 -0300 >Subject: [PATCH] Bug 28585: (QA follow-up) Add explicit tests for setting > date/date-time attributes > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/patrons.t | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index d8dc2ff608..ed8e7bec13 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -189,7 +189,7 @@ subtest 'add() tests' => sub { > $schema->storage->txn_rollback; > > subtest 'librarian access tests' => sub { >- plan tests => 22; >+ plan tests => 24; > > $schema->storage->txn_begin; > >@@ -284,6 +284,11 @@ subtest 'add() tests' => sub { > delete $newpatron->{anonymized}; > $patron_to_delete->delete; > >+ # Set a date field >+ $newpatron->{date_of_birth} = '1980-06-18'; >+ # Set a date-time field >+ $newpatron->{last_seen} = output_pref({ dt => dt_from_string->add( days => -1 ), dateformat => 'rfc3339' }); >+ > $t->post_ok("//$userid:$password@/api/v1/patrons" => json => $newpatron) > ->status_is(201, 'Patron created successfully') > ->header_like( >@@ -291,9 +296,11 @@ subtest 'add() tests' => sub { > 'SWAGGER3.4.1' > ) > ->json_has('/patron_id', 'got a patron_id') >- ->json_is( '/cardnumber' => $newpatron->{ cardnumber }) >- ->json_is( '/surname' => $newpatron->{ surname }) >- ->json_is( '/firstname' => $newpatron->{ firstname }); >+ ->json_is( '/cardnumber' => $newpatron->{ cardnumber }) >+ ->json_is( '/surname' => $newpatron->{ surname }) >+ ->json_is( '/firstname' => $newpatron->{ firstname }) >+ ->json_is( '/date_of_birth' => $newpatron->{ date_of_birth }, 'Date field set (Bug 28585)' ) >+ ->json_is( '/last_seen' => $newpatron->{ last_seen }, 'Date-time field set (Bug 28585)' ); > > warning_like { > $t->post_ok("//$userid:$password@/api/v1/patrons" => json => $newpatron) >@@ -432,7 +439,7 @@ subtest 'update() tests' => sub { > $schema->storage->txn_rollback; > > subtest 'librarian access tests' => sub { >- plan tests => 42; >+ plan tests => 44; > > $schema->storage->txn_begin; > >@@ -548,7 +555,6 @@ subtest 'update() tests' => sub { > is_deeply($got, $newpatron, 'Returned patron from update matches expected'); > t::lib::Dates::compare( $updated_on_got, $updated_on_expected, 'updated_on values matched' ); > >- > is(Koha::Patrons->find( $patron_2->id )->cardnumber, > $newpatron->{ cardnumber }, 'Patron is really updated!'); > >@@ -611,9 +617,16 @@ subtest 'update() tests' => sub { > delete $newpatron->{email}; > delete $newpatron->{secondary_email}; > delete $newpatron->{altaddress_email}; >+ >+ # Set a date field >+ $newpatron->{date_of_birth} = '1980-06-18'; >+ # Set a date-time field >+ $newpatron->{last_seen} = output_pref({ dt => dt_from_string->add( days => -1 ), dateformat => 'rfc3339' }); >+ > $t->put_ok( "//$userid:$password@/api/v1/patrons/" . $superlibrarian->borrowernumber => json => $newpatron ) >- ->status_is(200, "Non-superlibrarian user can edit superlibrarian successfully if not changing email"); >-# ->json_is( { error => "Not enough privileges to change a superlibrarian's email" } ); >+ ->status_is(200, "Non-superlibrarian user can edit superlibrarian successfully if not changing email") >+ ->json_is( '/date_of_birth' => $newpatron->{ date_of_birth }, 'Date field set (Bug 28585)' ) >+ ->json_is( '/last_seen' => $newpatron->{ last_seen }, 'Date-time field set (Bug 28585)' ); > > $schema->storage->txn_rollback; > }; >-- >2.33.1
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 28585
:
122381
|
122444
|
122445
|
122446
|
122457
|
122458
|
122459
|
123115
|
123116
|
123117
|
126668
|
126669
|
126670
|
126671
| 126679