[Koha-bugs] [Bug 35904] C4::Auth::checkauth cannot be tested easily
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Feb 14 10:14:40 CET 2024
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35904
--- Comment #4 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Created attachment 162135
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162135&action=edit
Bug 35904: Make C4::Auth::checkauth testable easily
This patch suggests to add a new flag do_not_print to
C4::Auth::checkauth to not print the headers and allow to test this
subroutine more easily.
We do no longer need to mock safe_exit and redirect STDOUT to test its
return values.
There are still 3 left:
1.
733 # checkauth will redirect and safe_exit if not authenticated and
not authorized
=> Better to keep this one, not trivial to replace
2.
806 # This will fail on permissions
This should be replaced but testing $template->{VARS}->{nopermission}
fails, I dont' think the comment is better.
3.
828 # Patron does not have the borrowers permission
Same as 2.
2. and 3. should be investigated a bit more.
This patch also move duplicated code to set patron's password to a
subroutine set_weak_password.
Test plan:
Read the code and confirm that everything makes sense.
QA: Do you have a better way for this? Yes it's dirty!
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list