Commit graph

7111 commits

Author SHA1 Message Date
4032da3f96
Bug 36066: (follow-up) Move 403 to 409 when status ne cancelled
Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:29 +01:00
8bb61c4f88
Bug 36066: Add tests
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] As Victor discovered, the test with status new in subtest
'delete' needed the authorised user now.

Test plan:
Run t/db_dependent/api/v1/acquisitions_orders.t
Without the follow-up patch this should FAIL.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:28 +01:00
85f316f9c8
Bug 35950: Adjust tests
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:26 +01:00
e0554260c7
Bug 35840: (QA follow-up) Tidy and critic fix
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:25 +01:00
8b14aca56c
Bug 35840: Add unit tests
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:24 +01:00
8a7a37fb35
Bug 36012: Add 'waits' to cypress test
This patch adds cy.wait() in two places where builds have been failing due to timeouts

Test plan:
1) cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-08 18:58:19 +01:00
285a0fc74d
Bug 35357: Enhance unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Fixed typo in test output.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:42 +01:00
0eced80866
Bug 35357: Remove item from holds queue when it is checked out
Test Plan:
1) Place a hold on an item
2) Build the holds queue
3) Check out the item to a different patron than the one
   targeted in the holds queue
4) Verify the holds queue viewer still shows that item and patron
5) Apply this patch
6) Repeat stepts 1 through 3
7) Verify the holds queue viewer no longer shows that patron and item!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:41 +01:00
0e11bc0de5
Bug 35357: Add unit test
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:41 +01:00
aa1049fdd3
Bug 36056: Clarify subpermissions AND behavior
Working on bug 31791, I found myself wondering if our current recursive
code in C4::Auth::haspermission() would allow checking AND on
subpermissions.

As it is not documented in the POD or tested, I decided to write some
unit tests for it.

It turned out it was well supported, so I decided to submit the tests,
and a small tweak in the POD to reflect that.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth/haspermission.t
=> SUCCESS: Tests pass! The code supports AND on subpermissions!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:40 +01:00
5e0afb772a
Bug 35469: Add 'manage_bookings' permission to biblios/checkouts
This patch adds the manage_bookings subpermission check to the
biblios/{biblio_id}/checkouts endpoint and updates the corresponding
unit test too.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:40 +01:00
30b3a8c382
Bug 35469: Add 'manage_bookings' subpermission to /checkouts
This patch adds the 'manage_bookings' permission to allow fetching of
checkouts on the API should the user have 'manage_bookings' but not have
'circulate_remaining_permissions'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 17:35:39 +01:00
2e6a2c3b5b
Bug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029
UT is failing in jenkins.
Change to use biblio.copyrightdate instead of bilio.medium

Run prove t/db_dependent/Items/AutomaticItemModificationByAge.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:46 +01:00
a71c21d2ff
Bug 31427: (follow-up) Unit tests
This patch adds a unit test for error precidence where autorenewals is
involved.

It is not comprehensive however, and I'm a little confused by the logic
around cron vs non-cron handling...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:43 +01:00
3e164d200a
Bug 36100: (QA follow-up) Move 400 to 409
Duplicate exceptions tend to generate a 409 in our REST API.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:42 +01:00
d810b3663b
Bug 36100: Update unit tests for add
This patch updates the unit tests for booking add to confirm that
without readOnly we still return an error should a user attempt to
submit a booking with a booking_id that would clash.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 16:36:42 +01:00
9b8cbf5c83
Bug 35963: (QA follow-up): tidy up code and fix exec permission
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 15:02:52 +01:00
Julian Maurice
9344f43170
Bug 35963: Add tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 15:02:51 +01:00
ab7a8db43d
Bug 35398: (QA follow-up) Tidy code
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 15:02:47 +01:00
de79e957ce
Bug 35398: Unit test
This patch adds the begginings of unit tests for Koha::EDI.  Right now
we only test that a simple QUOTE message creates a basket, adds the item
to said basket and assigns that single item to a corresponding stock
rotation rota as defined by the LRP segment in the QUOTE message.

It lays the foundations for much more rigorous tests to be written to
cover the whole of EDI.pm however.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 15:02:46 +01:00
6744b9979a
Bug 35398: Add unit test for extraction of library_rotation_plan
This unit test addition adds an LRP segment to the test EDI message file
and adds the corresponding test to confirm is it extracted into the
field as expected.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-03-07 15:02:46 +01:00
190ab37812
Bug 35329: Fix selenium tests if no fund exist
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-04 14:50:40 +01:00
24191009bd
Bug 36084: Fix cookie domain for www/ tests
This patch changes the hardcoded `koha.local` value on
t::lib::Mocks::Zebra so tests don't fail when the domain is not `koha`.

To test:
1. Run:
   $ ktd --shell
  k$ export KOHA_INTRANET_URL=http://kohadev-intra.myDNSname.org:8081
  k$ prove t/db_dependent/www/batch.t
=> FAIL: Tests fail!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-04 14:33:24 +01:00
e170a3c2ab
Bug 35329: (follow-up) Add styling to info and error
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 16:04:26 +01:00
7440730e9a
Bug 35329: Add POD + tidy Selenium.pm
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:01:22 +01:00
9470aa25fb
Bug 35329: Add cypress tests
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:01:21 +01:00
bf3ccde63f
Bug 35329: Add selenium tests
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:01:20 +01:00
6323e08ed7
Bug 36084: Fix file upload and www/batch.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:01:01 +01:00
59ae5d7b6d
Bug 36102: (follow-up 2) Add cud-login to the login form - fix tests
Bug 36102: [TO SQUASH] (follow-up 2) Add cud-login to the login form - fix tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:38 +01:00
c9375e746b
Bug 34478: (follow-up) Manual fix - Make Koha::Token use session id not userenv id
See comment 174.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:25 +01:00
f859c30704
Bug 34478: Fix www/auth_values_input_www.t
See bug 36189, we need to rewrite this using Selenium.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:24 +01:00
d6cf04d7da
Bug 34478: Fix selenium/administration_tasks.t
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:59:47 +01:00
dd5f3701ce
Bug 34478: op modify=>edit_form, add=>add_form - memberentry.pl
Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass opadd to template )- memberentry.pl

The template expects opadd when showing the form - along the way it was changed to 'add' and broke new patron
entry

Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass op to template )- memberentry.pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:57:02 +01:00
6870eb5329
Bug 34478: op=modify should be op=add_form - memberentry.pl
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:57:01 +01:00
93e717ac31
Bug 34478: Manual fix - opac-suggestions
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:10 +01:00
8a39b582f1
Bug 34478: Adjust selenium tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:08 +01:00
0631153f06
Bug 35955: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:53 +01:00
c42ede262a
Bug 36098: (follow-up) extend test to check driver
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:33 +01:00
0e6537d199
Bug 36098: Add Koha::Session module to ease session handling
This patch adds a Koha::Session module that makes it easier
to work with Koha sessions without needing the full C4::Auth module.

Test plan:
0. Apply the patch
1. Run the following unit tests:
prove ./t/db_dependent/Auth.t
prove ./t/db_dependent/Auth_with_cas.t
prove ./t/db_dependent/Koha/Session.t
2. Observe that they all pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:30 +01:00
1bc2f8cf1b
Bug 36092: Add test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:27 +01:00
837d04527a
Bug 35918: Add test
Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:25 +01:00
200799c11e
Bug 35890: Add tests for AutoLocation
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:24 +01:00
a82772d7ec
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!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:21 +01:00
a77adbe76e
Bug 36034: Add test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-02-14 10:32:04 +00:00
d130a6c66b
Bug 35962: (bug 35843 follow-up 2) Fix BackgroundJob.t on D10
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-02-06 08:52:36 +01:00
12b6c0e67d
Bug 34893: Unit tests for C4::Auth::checkpw
This patch introduces some tests on the current (and new) behavior for
the `checkpw` function.

I needed it to better understand if an edge case was actually possible
(it wasn't).

Found a really minor annoyance for the internal check with expired
password not returning the $patron object for consistency with the other
use cases.

I think this method deserves (at least) changing the return value to a
sane data structure. But that's not target for backporting to stable
releases. So a separate bug.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:48 +01:00
2b54d3c82b
Bug 34893: (QA follow-up) Tidy code for qa script
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:47 +01:00
795387f519
Bug 34893: Add unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:46 +01:00
3584cd7edb
Bug 32474: (follow-up): Tell the tests to wait for the intercepted request responses
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 13:37:03 +01:00
d7669ae2a9
Bug 35962: (bug 35843 follow-up) Fix BackgroundJob.t on D10
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 09:32:28 +01:00