We now have some tests for BreedingSearch.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Can't locate object method "new" via package "Koha::BackgroundJob::BatchUpdateBiblio" (perhaps you forgot to load "Koha::BackgroundJob::BatchUpdateBiblio"?) at t/db_dependent/Koha/BackgroundJobs/BatchUpdateBiblio.t line 45.
How did it pass at signoff?
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
If an exception is raised by one the methods/subroutines called when batch biblio update, the job will fail in the middle and some records won't be processed.
Test plan:
0. Don't apply the patch
In KTD you can run the a batch mod biblio on the 100 first records and
the worker will fail with
"""
countered object 'C4::Biblio::_koha_modify_biblioitem_nonmarc(): DBI Exception: DBD::mysql::st execute failed: Data too long for column 'lccn' at row 1 at /kohadevbox/koha/C4/Biblio.pm line 423
', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /kohadevbox/koha/Koha/BackgroundJob/BatchUpdateBiblio.pm line 120.
"""
The UI is not saying anything about this problem.
Generate 100 biblionumbers: perl -e 'for (1..100){print "$_\n"}'
1. Apply the patch and confirm than now you see the detail of the batch
update and that biblionumber 72 is marked as not been modified with the
correct error (raw DBI error)
JK: add executable bit to BatchUpdateBiblio.t
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Test plan:
Run t/db_dependent/Log.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Since bug 19185, and Koha_Master running the tests after t/db_dependent/selenium/01-installation.t is ran, t/db_dependent/selenium/administration_tasks.t is failing randomly with:
12:32:59 koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
12:32:59 koha_1 | /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:361 in Try::Tiny::try
12:32:59 koha_1 | (eval 1710):1 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1 | (eval 1712):2 in Selenium::Remote::Driver::__ANON__
12:32:59 koha_1 | /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in Selenium::Remote::Driver::_execute_command
12:32:59 koha_1 | /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in (eval)
12:32:59 koha_1 | /kohadevbox/koha/t/lib/Selenium.pm:170 in Selenium::Remote::Driver::find_element
12:32:59 koha_1 | t/db_dependent/selenium/administration_tasks.t:188 in t::lib::Selenium::click
I don't recreate it locally.
The screenshot of the failure shows that the screen is still on the authorised value list view.
This does not make a lot of sense, but I am failing to find a logic
here.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
# Failed test 'Identify - earliestDatestamp in the right format'
# at t/db_dependent/OAI/Server.t line 182.
# Compared $data->{"Identify"}{"earliestDatestamp"}
# got : '2021-11-15T13:16:09Z'
# expect : '2014-05-07T13:36:23Z'
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces a regression test for the fixed behavior.
I also changed a oneliner regex we had for stripping query parameters
because it was causing a warning with the tests base URL
(http://localhost) because it was generating an empty baseURL.
To test:
1. Apply the regression tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/OAI/Server.t
=> FAIL: Tests fail, the response is incorrect!
3. Apply the bug's patch
4. Repeat 2
=> SUCCESS: Tests pass! Good response!
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Test plan:
Run t/db_dependent/Koha/UI/Form/Builder/Item.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch is suggesting to move the broken test plugins into a separate
directory.
t/lib/plugins and t/lib/bad_plugins
Signed-off-by: David Nind <david@davidnind.com>
JK: Add executable bit to Broken.t
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces a new method to Koha::Email. This method allows us
to parse a MIME email to initialize the Koha::Email object. This is
particularly important when we are restoring emails from the DB. i.e.
from the *message_queue* table.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/Koha/Email.t
=> SUCCESS: Tests pass! Koha::Email->new_from_string is the correct
counterpart for Koha::Email->as_string!
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The 'Polish notation' actually simplifies things.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Rebased 21-09-21.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
1. This adds a simple regression test to make sure order_line() method
executes correctly with basket create_items set to "ordering" and
"receiving".
2. A simple test for the filename method is added
To test:
1) prove t/db_dependent/Koha/Edifact/Order.t
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Before dropping a primary key we need to see if one exists - this updates
the installer method to allow searching for existence of key
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26326: (follow-up) Address qa script failures
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Test plan:
Run t/db_dependent/Koha/Plugins/authority_hooks.t
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Run prove t/db_dependent/Search.t
Without fix you get error :
# Failed test 'buildQuery should keep 0 value in query_cgi'
# at t/db_dependent/Search.t line 670.
# got: 'idx=su%2Cphr'
# expected: 'idx=su%2Cphr&q=0'
This patch also adds a test for query_desc in case it is broken in the
future.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
We should die on invalidly formatted dates being passed. This patch
adds such a test case.
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The tests were incorrectly passing for RFC3339 dates passed with an
offset. This patch corrects the test.
Test plan:
1/ Read the change
2/ Agree the change adheres to the RFC
3/ Run the test and varify it now fails
3/ Signoff
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This is just reusing what is done in Search.t (and that is correct).
But search_utf8.t and remove_from_cart.t are wrong as we want to use the
UI (and we cannot mock the zebra index, ie. koha-conf, from tests for
plack).
This still needs some work but improve a bit the existing code and make
tests pass (hopefully!)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
To recreate run:
drop database koha_kohadev;
create database koha_kohadev;
restart_all
KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t t/db_dependent/Search.t t/db_dependent/Koha/UI/Form/Builder/Item.t
# Failed test 'Item types should be sorted by description and an empty entries should be shown'
# at t/db_dependent/Koha/UI/Form/Builder/Item.t line 127.
# Structures begin differing at:
# $got = undef
# $expected = ARRAY(0x557716b68e98)
# Itemtypes details: $VAR1 = undef;
# $VAR2 = [
# 'BK',
# 'CF',
# 'CR',
# 'ihxGmo7',
# 'MP',
# 'MU',
# 'MX',
# 'REF',
# 'VM'
# ];
# Failed test 'Labels should be correctly displayed'
# at t/db_dependent/Koha/UI/Form/Builder/Item.t line 130.
# Structures begin differing at:
# $got = undef
# $expected = HASH(0x557716e2e150)
# Looks like you failed 2 tests of 2.
# Failed test 'itemtypes'
# at t/db_dependent/Koha/UI/Form/Builder/Item.t line 133.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patchset moves the 'category' attribute for virtual shelves, that
takes values of 1 and 2 (private and public respectively) into a boolean
for public.
The DBRev is trivial, and the changes to the code are as well.
To test:
1. have some known public and private lists
2. Apply this patches
3. Run:
$ updatedatabase
=> SUCCESS: Public lists have public=1, private have public=0
4. Run:
$ kshell
k$ prove t/db_dependent/Utils/Datatables_Virtualshelves.t \
t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
5. Try the feature in staff and OPAC
=> SUCCESS: All good
6. Sign off :-D
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch adds unit tests for the new route. All behaviors are tested:
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch makes the query for randomly generated libraries
deterministic, thus getting rid of the random tests failures.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch converts the code to use an allow-list as aposed to a
deny-list. This is more 'fail safe' than requireing maintanence of a
deny-list.
We also switch to using db fields names for the list as aposed to api
mapped names. This way, the list can be re-used for non-api related
sanitising if required.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch makes the API authentication code stash the 'is_public' value
when public routes are hit.
This will be particularly useful to have $c->objects->search generically
pass this info down to the ->to_api method.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t
=> SUCCESS: Tests pass! When a public route is reached, the controller
has the 'is_public' value stashed
3. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces a way for Koha::Object(s)->to_api to filter out
attributes that require privileged access. It is done in a way that the
'public' parameter is recursively passed to nested objects in recursive
to_api() calls.
This way, Koha::Object-based classes can determine how they will render
depending on this parameter. For example, for implementing a
route for fetching an library looks like:
GET /libraries
The controller will look like:
my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
status => 200,
openapi => $library->to_api
);
Implementing an unprivileged (public) route would look like:
GET /public/libraries/:library_id
The controller will look like:
my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
status => 200,
openapi => $library->to_api({ public => 1 })
);
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Object*.t
=> SUCCESS: Tests pass (i.e. current behaviour is kept, new behaviour
passes the tests)
3. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch removes an early short-circuit we had, which wasn't correct
regarding the OpacPasswordChange syspref. If a patron category is
allowed to change password, it overrides the syspref.
To test:
1. Tests still pass.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces regression tests for the described bug.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, excepted failures are considered success
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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch adds unit tests to ensure we do not leak branch specific
addtional contents blocks outside of logged in sessions (i.e. where a
users branch is not yet set).
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>