feat(items): wrap GET totalusercopyrights endpoint#192
Conversation
Refs fossology#52. Adds Items.item_user_copyrights() for GET /uploads/{id}/item/{itemId}/totalusercopyrights, the user-findings counterpart to the existing item_copyrights() (totalcopyrights). It mirrors that method exactly, including the {active,inactive} status query param and the int return type. Validated against the OpenAPI spec (API 1.6.2 / Fossology 4.4.0). Tests mirror the existing totalcopyrights coverage: live happy path, unknown-item 404, and a mocked 500 error path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds support in the Python wrapper for the Fossology REST API endpoint that returns the total user copyright findings for an upload-tree item (GET /uploads/{id}/item/{itemId}/totalusercopyrights), mirroring the existing totalcopyrights wrapper.
Changes:
- Add
Items.item_user_copyrights()wrapper method (includingstatus={active,inactive}query param) returning anint. - Add integration + mocked error-path tests mirroring existing
item_copyrights()coverage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| fossology/items.py | Adds the new item_user_copyrights() API wrapper alongside item_copyrights(). |
| tests/test_items.py | Adds tests for happy path, 404 handling, and a mocked 500 error for the new endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| :param status: the status of the copyrights | ||
| :type upload: Upload | ||
| :type item_id: int, | ||
| :type status: CopyrightStatus | ||
| :return: the total number of user copyright findings for the uploadtree item |
|
Closing this after verifying against the fossology 4.4.0 container that CI pins (API 1.6.1): |
Refs #52.
Adds
Items.item_user_copyrights()forGET /uploads/{id}/item/{itemId}/totalusercopyrights, mirroring the existingitem_copyrights().Closed: this endpoint is API 1.6.2 / master-only and does not exist in fossology 4.4.0 (the version CI pins), so it 404s there. Will revisit when the CI target includes it.