Unit/System Tests Webservices PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
27 Dec 2024

Pull Request for Issue # .

Summary of Changes

added endpoints for content category history

  • GET v1/content/category/:id/contenthistory
  • PATCH v1/content/category/:id/contenthistory/keep
  • DELETE v1/content/category/:id/contenthistory

Testing Instructions

npm cypress run --spec tests/System/integration/api/com_contenthistory/Content_Category.cy.js

Actual result BEFORE applying this Pull Request

N/A

Expected result AFTER applying this Pull Request

test + endpoint

Link to documentations

As discussed, this API enhancement will be documented first in https://manual.joomla.org/migrations/54-60/new-features, please note:

  • id for /v1/content/category/:id/contenthistory is the contenthistory and NOT the category.id
  • PATCH is only available for the attribute keep_forever with /v1/content/category/:id/contenthistory/keep

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar alikon alikon - open - 27 Dec 2024
avatar alikon alikon - change - 27 Dec 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Dec 2024
Category Front End Plugins JavaScript Unit Tests
avatar alikon alikon - change - 27 Dec 2024
The description was changed
avatar alikon alikon - edited - 27 Dec 2024
avatar QuyTon QuyTon - change - 22 Jan 2025
Title
[5.3] Content category history endopoint
[5.3] Content category history endpoint
avatar QuyTon QuyTon - edited - 22 Jan 2025
avatar alikon alikon - change - 23 Jan 2025
Labels Added: Unit/System Tests Documentation Required Webservices PR-5.3-dev
avatar alikon alikon - change - 24 Mar 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-03-24 21:43:44
Closed_By alikon
avatar alikon alikon - close - 24 Mar 2025
avatar alikon alikon - change - 15 May 2025
Status Closed New
Closed_Date 2025-03-24 21:43:44
Closed_By alikon
avatar alikon alikon - change - 15 May 2025
Status New Pending
avatar alikon alikon - reopen - 15 May 2025
avatar alikon alikon - change - 15 May 2025
Title
[5.3] Content category history endpoint
[5.4] Content category history endpoint
avatar alikon alikon - edited - 15 May 2025
avatar alikon alikon - change - 15 May 2025
Labels Added: PR-5.4-dev
Removed: Documentation Required PR-5.3-dev
201a31b 16 May 2025 avatar alikon cs
9e73b71 16 May 2025 avatar alikon cs
avatar muhme
muhme - comment - 17 May 2025

Thank you @alikon for your contribution and for adding System Tests for the new REST API category history functionality.

Is it possible to also test PATCH and DELETE requests in the System Tests after testing GET?

I would test in parallel with curl or postman and document this as the mentioned System Test spec is already included in the CI. And would ask around how to proceed with the documentation, e.g. there is no POST as the history entries are only created implicit.

avatar alikon
alikon - comment - 18 May 2025

yes, of course
but i'll be slow, i'm short in free time currently

e424d98 26 May 2025 avatar alikon PATCH
27924ba 26 May 2025 avatar alikon keep
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jun 2025
Category Front End Plugins JavaScript Unit Tests Administration Language & Strings Front End Plugins JavaScript Unit Tests
avatar richard67 richard67 - change - 8 Jun 2025
Title
[5.4] Content category history endpoint
[6.0] Content category history endpoint
avatar richard67 richard67 - edited - 8 Jun 2025
avatar richard67
richard67 - comment - 8 Jun 2025

@alikon We have discussed this PR among release managers and decided to move it to 6.0-dev as it's a new feature, so I've just rebased your PR. Now it shows 2 unrelated changes, but these will disappear after the next upmerge and branch update.

avatar muhme muhme - test_item - 10 Jun 2025 - Tested unsuccessfully
avatar muhme
muhme - comment - 10 Jun 2025

I have tested this item 🔴 unsuccessfully on 6ceaaf1

I have tested with current 6.0-dev and curl command line (script and output will be attached to the PR)

  • ✅ With wrong API token
    • GET /v1/content/category/:id/contenthistory -> 401 "Unauthorized" with error "Forbidden"
    • PATCH /v1/content/category/:id/contenthistory/keep -> 401 "Unauthorized" with error "Forbidden"
    • DELETE /v1/content/category/:id/contenthistory -> 401 "Unauthorized" with error "Forbidden"
  • GET /v1/content/category/:id/contenthistory -> 200 "OK" and returning the entry in JSON format
  • PATCH /v1/content/category/:id/contenthistory/keep -> 200 "OK" and empty return
    • ✅ And verified next GET has "keep_forever" : 1 set
  • DELETE /v1/tags/:id/contenthistory -> 204 "No Content" end no content returned
    • database entry is still present
    • second delete returns again 204 and database entry still exists
  • ❌ Non existing entries, expected is e.g. 404 "Not Found"
    • GET /v1/content/category/4711/contenthistory -> 200 "OK" and json structure with self link and empty data and empty meta
    • PATCH /v1/content/category/4711/contenthistory/keep -> 400 "Bad Request" with JSON error "Changed the keep forever value for a history version."
    • DELETE /v1/content/category/4711/contenthistory -> 500 "Internal Server Error" with JSON error "RuntimeException"
  • ✅ System Tests for GET, PATCH and DELETE are existing and working
    • Perhaps, they could be extened for testing non-existing :id? Trying to delete the contenthistory entry a second time would also show the contenthistory entry was deleted.

Not tested was the following. Should this or something elso be tested next time?

  • PATCH with malformed JSON
  • PATCH with unsupported fields

The database has been checked in parallel and regardless of this PR, the content history entries for content category are not deleted when the content category is deleted and I will extend the issue #45584 for this.

Regardless of this PR, testing also found that attempting to delete an not-trashed content category via the API results in 500, and I will create an issue for that.

There is are difference in the endpoints using singular and plural with #44669 is this intended? For example:

Files

avatar muhme muhme - change - 10 Jun 2025
The description was changed
avatar muhme muhme - edited - 10 Jun 2025

Add a Comment

Login with GitHub to post a comment