Bugzilla – Attachment 122457 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: Regression tests
Bug-28585-Regression-tests.patch (text/plain), 2.46 KB, created by
David Nind
on 2021-06-25 23:32:35 UTC
(
hide
)
Description:
Bug 28585: Regression tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-06-25 23:32:35 UTC
Size:
2.46 KB
patch
obsolete
>From c01323937daa30d446b760346618433ce74a74e3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 25 Jun 2021 09:57:11 -0300 >Subject: [PATCH] Bug 28585: Regression tests > >This patch adds tests for filtering GET calls with date/date-time >parameters. Tests fail because the feature is not working > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/api/v1/patrons.t | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 41f5681095..78ec764422 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -27,6 +27,7 @@ use t::lib::Mocks; > > use C4::Auth; > use Koha::Database; >+use Koha::DateUtils qw(dt_from_string output_pref); > use Koha::Exceptions::Patron; > use Koha::Exceptions::Patron::Attribute; > use Koha::Patron::Attributes; >@@ -46,7 +47,7 @@ subtest 'list() tests' => sub { > $schema->storage->txn_rollback; > > subtest 'librarian access tests' => sub { >- plan tests => 16; >+ plan tests => 17; > > $schema->storage->txn_begin; > >@@ -84,6 +85,34 @@ subtest 'list() tests' => sub { > ->json_is( '/0/restricted' => Mojo::JSON->true ) > ->json_hasnt('/1'); > >+ subtest 'searching date and date-time fields' => sub { >+ >+ plan tests => 6; >+ >+ my $date_of_birth = '1980-06-18'; >+ my $last_seen = '2021-06-25 14:05:35'; >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ dateofbirth => $date_of_birth, >+ lastseen => $last_seen, >+ } >+ } >+ ); >+ >+ my $last_seen_rfc3339 = $last_seen . "z"; >+ >+ $t->get_ok("//$userid:$password@/api/v1/patrons?date_of_birth=" . $date_of_birth . "&cardnumber=" . $patron->cardnumber) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date works' ); >+ >+ $t->get_ok("//$userid:$password@/api/v1/patrons?last_seen=" . $last_seen_rfc3339 . "&cardnumber=" . $patron->cardnumber) >+ ->status_is(200) >+ ->json_is( '/0/patron_id' => $patron->id, 'Filtering by date-time works' ); >+ }; >+ > $schema->storage->txn_rollback; > }; > }; >-- >2.20.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