Bugzilla – Attachment 133891 Details for
Bug 29926
Add ability for superlibrarians to edit password expiration dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29926: (QA follow-up) Date format missing in spec
Bug-29926-QA-follow-up-Date-format-missing-in-spec.patch (text/plain), 2.80 KB, created by
Tomás Cohen Arazi
on 2022-04-26 13:14:15 UTC
(
hide
)
Description:
Bug 29926: (QA follow-up) Date format missing in spec
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2022-04-26 13:14:15 UTC
Size:
2.80 KB
patch
obsolete
>From 7a06258106211a98a10994de54346899c7535fd5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 26 Apr 2022 10:09:04 -0300 >Subject: [PATCH] Bug 29926: (QA follow-up) Date format missing in spec > >On fixing the spec to have `format: date` I noticed the tests were >expecting explosions because of date handling not being done. The >OpenAPI plugin does this correctly when you set the format right. > >So, I adapted the tests so they expect 400 and return the type error. > >We don't usually add such tests (i.e. test the plugin does its job >correctly) but it doesn't hurt to keep them just in case something >really changes badly there (plugin bug?). > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > api/v1/swagger/paths/patrons_password.yaml | 1 + > t/db_dependent/api/v1/patrons_password_expiration.t | 11 ++--------- > 2 files changed, 3 insertions(+), 9 deletions(-) > >diff --git a/api/v1/swagger/paths/patrons_password.yaml b/api/v1/swagger/paths/patrons_password.yaml >index 20c23db0e5b..393dfa6e916 100644 >--- a/api/v1/swagger/paths/patrons_password.yaml >+++ b/api/v1/swagger/paths/patrons_password.yaml >@@ -77,6 +77,7 @@ > expiration_date: > description: Date to expire password > type: string >+ format: date > required: > - expiration_date > additionalProperties: false >diff --git a/t/db_dependent/api/v1/patrons_password_expiration.t b/t/db_dependent/api/v1/patrons_password_expiration.t >index 603d8d9c113..9e444acbf0c 100755 >--- a/t/db_dependent/api/v1/patrons_password_expiration.t >+++ b/t/db_dependent/api/v1/patrons_password_expiration.t >@@ -52,8 +52,6 @@ subtest 'basic tests' => sub { > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >- t::lib::Mocks::mock_preference( 'dateformat','us' ); >- > my $new_password = 'abc'; > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" >@@ -66,16 +64,13 @@ subtest 'basic tests' => sub { > . $patron->id > . "/password/expiration_date" => json => > { expiration_date => '01/13/2021' } ) >- ->status_is(200)->json_is(''); >+ ->status_is(400)->json_is('/errors/0/message' => 'Does not match date format.'); > > $t->put_ok( "//$userid:$password@/api/v1/patrons/" > . $patron->id > . "/password/expiration_date" => json => > { expiration_date => '13/01/2021' } ) >- ->status_is(500)->json_is({ >- error => 'Something went wrong, check Koha logs for details.', >- error_code => "internal_server_error" >- }); >+ ->status_is(400)->json_is('/errors/0/message' => 'Does not match date format.'); > > $privileged_patron->flags(0)->store(); > >@@ -90,7 +85,5 @@ subtest 'basic tests' => sub { > } > }); > >- >- > $schema->storage->txn_rollback; > }; >-- >2.34.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 29926
:
130551
|
130552
|
130553
|
130686
|
130687
|
130688
|
133759
|
133760
|
133761
|
133887
|
133888
|
133889
|
133890
| 133891