Commit Graph

7764 Commits

Author SHA1 Message Date
Kyle M Hall 5997e2a859
Bug 38486: Fix unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 87cc6a9cc8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-01-30 22:54:33 +01:00
Marcel de Rooy cc32488b4a
Bug 38758: Add subtest to Letters.t
Test plan:
Run t/db_dependent/Letters.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit b2f3f8b6ea4ae63d762dc51274a2b2c4065acdf0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2024-12-30 12:22:42 +01:00
Jonathan Druart ed25a48ccf
Bug 38526: (bug 36822 follow-up): Improve datetime comparison in tests
17:39:54 koha_1       |     #   Failed test 'updated_on correctly saved on newly created user'
17:39:54 koha_1       |     #   at t/db_dependent/Auth_with_shibboleth.t line 319.
17:39:54 koha_1       |     #     Structures begin differing at:
17:39:54 koha_1       |     #          $got->[0] = '2024-11-19 16:39:30'
17:39:54 koha_1       |     #     $expected->[0] = '2024-11-19 16:39:29'
17:39:54 koha_1       |     # Looks like you failed 1 test of 54.

We must use t::lib::Dates::compare to compare datetimes in tests.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-25 13:16:40 +01:00
Nick Clemens 62e8bae08d
Bug 37349: Unit tests
This patch adds tests to verify the cahcing of authority type in LinkBibHeadingsToAuthority
and adjusts other tests to clear the cache when changing marc flavour

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-25 13:16:39 +01:00
Marcel de Rooy 28d24aaa08
Bug 38513: Fix Biblio.t for Koha_Main_My8
This should do the tric: The test output shows that the second
mapping was not found (field 264); also the expected suspect btw.
So adding that here.

Test plan:
Run t/db_dependent/Biblio.t
See also comment28 on bug 19097.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Simulated the above by removing 264c from Koha to MARC mapping.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:41 +01:00
Emily Lamancusa d013a4aef0
Bug 38343: (QA follow-up) Improve tests and tidy
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:40 +01:00
Jonathan Druart e868ff21ff
Bug 38343: Do not show closed invoices by default when receiving
Filter out closed invoices by default when receiving.

Test plan:
1.) go to acquisition module and search for a vendor
2.) click on button 'receive shipment'
3.) enter an invoice number and click 'next'
4.) click on button 'finish receiving'
5.) activate the checkbox 'close'
6.) click on button 'save'
7.) Check that your Invoice has been modified. The status is now "Closed on ..." and the checkbox is now 'Reopen'
8.) Click on the link to the vendor to go the vendors page
9.) click on button 'receive shipment'
=> The closed invoice is no longer displayed

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:39 +01:00
Katrin Fischer 9cd189ad16
Bug 38444: Fix unit test count
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:36 +01:00
David Cook 2683b8332b
Bug 38444: (QA follow-up) tidy
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:36 +01:00
Nick Clemens c79358235b
Bug 38444: Unit test to ensure limited categories don't break display
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:35 +01:00
Paul Derscheid 66de1f82eb
Bug 38501: Prevent failures of Koha/Booking.t when running the Koha_Main_My8 job
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-21 13:49:09 +01:00
Emily Lamancusa c5d899c584
Bug 38299: Update tests
To test:
prove -v t/Koha/Installer/Output.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:44:38 +01:00
David Cook 8b952b1a34
Bug 38416: Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:44:33 +01:00
David Cook a9eaefa3b8
Bug 38416: Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:44:33 +01:00
David Cook 425af8aaad
Bug 30745: (QA follow-up) tidy
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:44:31 +01:00
Olivier V 2b19d59a1b
Bug 30745: (follow-up) Rewritting the st-date-normalized test
The patch was corrupted, and was rewritten as the original one by
Hammat

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:44:30 +01:00
Jonathan Druart eebc357ac5
Bug 36454: Selenium - test patrons must start with 'test_'
I usually
 > delete from borrowers where surname like "test_"
So I do not need to reset_all

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:04:27 +01:00
Jonathan Druart ca66e0b091
Bug 36454: Fix and add API tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:04:26 +01:00
Pedro Amorim 7882a2fc0e
Bug 36454: (QA follow-up): Selenium - Add regression tests
Test plan:
1) $ ktd --selenium up
2) prove t/db_dependent/selenium/patrons_search_badges.t

Ensure these tests pass before and after the previous 'Use native is_expired instead of redundant JS calculation' patch.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:04:25 +01:00
Matt Blenkinsop a35c89fa29
Bug 33641: (Follow-up) Fix Indexer.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-15 15:50:08 +01:00
Jonathan Druart 4f5a495509
Bug 36640: Fix Asset.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-15 14:14:08 +01:00
Matt Blenkinsop 16d04b16b7
Bug 33641: (follow-up) Fix unit tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-15 14:02:20 +01:00
Jake Deery 26e5852890
Bug 37576: (follow-up) Fix for UserRoles test
This patch, although not directly caused by Bug 37576,
fixes issues with the UserRoles cypress test due
to a change in the data structure brought on by recent
ERM bugs.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-15 09:13:20 +01:00
Jake Deery 357582ee61
Bug 37576: (follow-up) fix broken cypress tests
This patch is intended to fix failing Cypress tests
by including the correct payload in get_agreement()
found in e2e.js, and by moving get_package to the
e2e.js with corrected payload also

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 16:47:05 +01:00
Nick Clemens b2d02523b2
Bug 33641: (follow-up) Change return_branch to checkin_library
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:41 +01:00
Eric Garcia 51206a1f4a
Bug 33641: 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-11-14 14:19:40 +01:00
Jonathan Druart 51a38670d5
Bug 36640: Fix selenium/patrons_search.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:37 +01:00
Jonathan Druart 9315a628a2
Bug 36640: Remove jEditable
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:37 +01:00
Jonathan Druart 1577934808
Bug 36640: Fix selenium tests
Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 14:19:27 +01:00
Jonathan Druart 27e8543d91
Bug 38011: Fix ReNewSubscription.t
t/db_dependent/Serials/ReNewSubscription.t .. Value not allowed for auto_incr id in Aqbookseller at /kohadevbox/koha/t/lib/TestBuilder.pm line 402.
Null value for subscriptionid in Subscriptionhistory not allowed at /kohadevbox/koha/t/lib/TestBuilder.pm line 415.
Can't call method "enddate" on an undefined value at t/db_dependent/Serials/ReNewSubscription.t line 102.

It's failing when no vendor with id=1 in DB.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:40 +01:00
Jan Kissig 7509681e10
Bug 23426: (follow-up) Fix failing test to send correct summary flag
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:39 +01:00
Jonathan Druart 6222eaa628
Bug 14670: Fix tests and import
Sponsored-by: Orex Digital
Signed-off-by: Alexandre Noel <alexandre.noel@inlibro.com>
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:37 +01:00
Martin Stenberg 8fe7f04e51
Bug 14670: add test for C4::Record::marc2cites
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:33 +01:00
Kyle M Hall 6b96763992
Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files
The system is vulnerable to Formula Injection attacks as the data
stored within the database and exported as CSV/Excel is not being
sanitized or validated against implanted formula payloads

This patch modifies all uses of Text::CSV and derived classes to pass
the "formula" parameter with value of "empty" which replaces formulas
by empty string.

Test Plan:
1) Apply this patch
2) For guided_reports.pl, attempt to export CSV where you've set a column to a formula somehow
   ( such as "=1+3" )
3) Export that CSV file
4) Note the formula has not been exported
5) Repeat this plan for the remaining scripts that export CSV files
   where users can define the outputted data

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Fixed two conflicts. I have tested that this works as advertised on:
- Reports (Download > Comma separated text (.csv)) [Text::CSV::Encoded]
- Circulation > Overdues > Download file of all overdues [Text::CSV_XS]
- misc/export_borrowers.pl [Text::CSV]
This covers all modules used, and both GUI and command line.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Change none to empty in the commit message ! None is the default,
doing nothing. Empty clears the formulas.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:31 +01:00
Tomas Cohen Arazi 5f5206d0e5
Bug 38418: Make SIP/Transaction.t run on all dateformat values
To test:
1. Change the `dateformat` syspref to any value other than `us`(shows as mm/dd/yyyy)
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/SIP/Transaction.t
=> FAIL: Tests fail because of the resulting string containing an unexpected date format.
3. Repeat 1-2 with other formats
=> FAIL: SAme
4. Choose `us`
5. Repeat 2
=> SUCCESS: It passes
6. Apply this patch
7. Repeat 2
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-13 17:00:53 +01:00
Martin Renvoize a9e7e8f14d
Bug 38322: (QA follow-up) Fix spelling
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-13 17:00:51 +01:00
Nick Clemens 0e899b8882
Bug 38322: Adjust tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-13 17:00:51 +01:00
Jonathan Druart 1a9dfde667
Bug 28633: Fix patrons_search.t
This does not belong here, but raised to me here, so attaching on this
one.
This feels like it's coming from bug 33484, but those tests were passing
after it has been pushed.

This patch fixes the following error:
Error while executing command: stale element reference: The element reference of <input type="text"> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed at /usr/share/perl5/Selenium/Remote/Driver.pm line 411.

Since bug 33484 the row with the filters is redrawn on table redraw. So
we need to search for the input every time the table is redrawn.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-13 17:00:48 +01:00
Janusz Kaczmarek fb0f1efeba
Bug 38235: Unit tests
BTW, tiny adjustments to existing tests to work with modified
C4::Suggestions::ModSuggestion.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-12 17:50:18 +01:00
Nick Clemens d7fa540195
Bug 28633: (follow-up) Set preferred name and adjust counts for tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-12 17:50:14 +01:00
Martin Renvoize ce5c7695e2
Bug 38390: Add subscriptions+count to vendors embed
This patch adds the subscriptions+count option to the embeddable enum
for the /vendors endpoint.

Test plan
1) Inspect the change to t/db_dependant/api/v1/acquisitions_vendors.t
   and confirm it's testing for the addition of subscriptions_count.
2) Run the above tests and confirm it passes

Note: For the above tests to pass, you will need to ensure your api
bundle is rebuilt after the patches are applied and restart plack.
`yarn build && restart_all` in ktd

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:23 +01:00
Matt Blenkinsop 28e32ee1a4
Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:15 +01:00
Matt Blenkinsop f516bff8ae
Bug 34355: Add unit tests
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:15 +01:00
Martin Renvoize 72882360dc
Bug 38011: (QA follow-up) Additional unit tests
Add an additional unit test for the default null on the new constraint.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:07 +01:00
Martin Renvoize 39fa74f683
Bug 17976: (QA follow-up) Add missing transaction rollback
We were missing the transaction wrapper for the overdue_fines test added
in this patchset.  This caused problems in subsequent tests.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 15:35:36 +01:00
Lukas Koszyk 6d884baf99
Bug 36026: Use only configured TLS options for database connection
Database connections with TLS require client private keys
and certificates for authentication but MariaDB also supports
authentication by user and password.

This patch allows omitting the TLS options for certificate based
client authentication.

This is not easily testable within a development environment like ktd.
But the patch has been verified by different parties on
production and testing systems installed with Debian packages.

0) Apply patch.
1) Configure the database to support TLS connections.
2) Set "<tls>yes</tls>" in the config section in koha-conf.xml.
3) Run "koha-plack --reload <koha_instance>".
4) Open Koha's staff interface in the browser.
5) Observe an internal server error.
6) Apply patch.
7) Repeat step 3 and 4.
8) Observe the error is gone.
9) Run "prove -v t/db_dependent/Koha/Database.t"

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Cornelius Amzar <cornelius.amzar@bsz-bw.de>
Signed-off-by: Markus John <markus.john@bsz-bw.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 15:35:36 +01:00
Nick Clemens ad610c8211
Bug 23486: Add creation to TrackLasPatronActivity triggers
Some libraries would like to update the last seen when a patron is created to avoid NULL
values and ensure new users are marked as 'active'

To test:
1 - Apply patch
2 - Create a new patron, confirm their lastseen date is null
    SELECT lastseen FROM borrowers WHERE cardnumber={their cardnumber}
3 - Update preference 'TrackLastPatronActivity' to include 'Patron creation'
4 - Create a second patron, confirm their lastseen is set
5 - Update preference 'TrackLastPatronActivity' to include 'Checking out an item'
6 - Checkout an item to the second patron
7 - Confirm their lastseen is not updated (We only update once per day)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 14:12:16 +01:00
Aleisha Amohia 8e73930408
Bug 33348: Tests
prove t/Koha/SearchEngine/Elasticsearch/Search.t

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 14:12:14 +01:00
Martin Renvoize b54850fc29
Bug 28633: (QA follow-up) Fix test plans
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 14:12:10 +01:00
Martin Renvoize a66cf06443
Bug 28633: (QA follow-up) Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 14:12:10 +01:00