Koha-clms/t/db_dependent/api/v1
Martin Renvoize 3a05b239db
Bug 29016 [25.11.x]: (QA follow-up) Expand action_logs API and test coverage
Build on the new ActionLog DBIC relations to expose them as opt-in
embeds, and shore up gaps in the test coverage that QA flagged.

Swagger
  * paths/action_logs.yaml declares an x-koha-embed header parameter
    constrained to the supported relations (librarian, patron).
  * definitions/action_log.yaml adds the corresponding optional
    `librarian` and `patron` object fields.

Tests
  * Convert the single 24-test subtest into focused subtests:
    - authorization (403 vs 200)
    - simple typed filters
    - q-DSL: multi-value module, info LIKE, combined filter
    - embeds: librarian and patron, with and without x-koha-embed
    - pagination + X-Total-Count and order_by
  * Mock AuthSuccessLog/AuthFailureLog/BorrowersLog to 0 to remove the
    flakiness where the API GET itself appended an AUTH log row between
    delete and assertion.
  * Build the test librarian with both `tools` and `borrowers` flags so
    embedded patron fields are not redacted by Koha::Patron->is_accessible.
  * Use a small build_fixtures() helper to avoid copy-pasting setup
    across subtests.

Test plan:
  1. yarn build && restart_all  (refresh swagger bundle)
  2. prove t/db_dependent/api/v1/action_logs.t  (all subtests green)
  3. curl -H 'x-koha-embed: librarian,patron' \
       /api/v1/action_logs?module=MEMBERS  -- patron and librarian
       objects appear in the response.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:26 +01:00
..
items
…
public
…
acquisitions_baskets.t
…
acquisitions_funds.t
…
acquisitions_orders.t
…
acquisitions_vendor_issues.t
…
acquisitions_vendors.t
…
action_logs.t Bug 29016 [25.11.x]: (QA follow-up) Expand action_logs API and test coverage 2026-05-24 13:42:26 +01:00
additional_contents.t
…
advanced_editor_macros.t
…
article_requests.t
…
auth.t
…
auth_authenticate_api_request.t
…
auth_basic.t
…
authorised_values.t
…
authorities.t Bug 41901: (follow-up) Fix perlcritic violation in unit tests 2026-05-24 13:42:22 +01:00
biblios.t
…
bookings.t
…
cash_registers.t
…
cashups.t Bug 41751: Allow anonymous_refund permission to access cashups API 2026-05-24 13:42:24 +01:00
checkouts.t
…
circulation_rules.t
…
cities.t
…
clubs_holds.t
…
deleted_biblios.t
…
edifact_files.t
…
erm_agreements.t
…
erm_counter_files.t
…
erm_counter_logs.t
…
erm_counter_registries.t
…
erm_custom_reports.t
…
erm_documents.t
…
erm_eholdings_packages.t
…
erm_eholdings_resources.t
…
erm_eholdings_titles.t
…
erm_licenses.t
…
erm_sushi_services.t
…
erm_usage_data_providers.t
…
erm_usage_titles.t
…
erm_users.t
…
extended_attribute_types.t
…
file_transports.t
…
holds.t
…
idp.t
…
ill_backends.t
…
ill_batches.t
…
ill_batchstatuses.t
…
ill_requests.t
…
import_batch_profiles.t
…
import_record_matches.t
…
item_groups.t
…
item_types.t
…
items.t
…
jobs.t
…
libraries.t Bug 42206: (follow-up) Rename to /closed_dates, improve efficiency 2026-05-24 13:42:24 +01:00
oauth.t
…
pagination.t
…
password_validation.t
…
patron_categories.t
…
patrons.t
…
patrons_accounts.t
…
patrons_checkouts.t
…
patrons_extended_attributes.t
…
patrons_hold_groups.t
…
patrons_holds.t
…
patrons_password.t
…
patrons_password_expiration.t
…
patrons_recalls.t
…
preservation_Processings.t
…
preservation_Trains.t
…
preservation_WaitingList.t
…
provider.t
…
query.t
…
record_sources.t
…
responses.t
…
return_claims.t
…
search_filters.t
…
sip2_accounts.t
…
sip2_institutions.t
…
sip2_system_preference_overrides.t
…
smtp_servers.t
…
stockrotation_rotas.t
…
stockrotationstage.t
…
suggestions.t
…
ticket_updates.t
…
tickets.t
…
transfer_limits.t
…
two_factor_auth.t
…
unhandled_exceptions.t
…