feat(license): wrap GET /license/export-csv endpoint#191
Closed
Valyrian-Code wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the Python Fossology client’s license import/export support by adding wrappers for the remaining REST endpoints in the license import/export surface (CSV export, JSON import, JSON export), along with integration and mocked-error tests to validate behavior against the API contract referenced in #52.
Changes:
- Add
export_licenses_csv()wrappingGET /license/export-csv(returns CSV text; raises on non-200). - Add
import_licenses_json()wrappingPOST /license/import-json(multipart upload usingfileInput; returns server message; raises on non-200). - Add
export_licenses_json()wrappingGET /license/export-json(returns parsed JSON; raises on non-200) and corresponding round-trip + error-path tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
fossology/license.py |
Implements CSV export, JSON import, and JSON export license endpoint wrappers with consistent success/error handling. |
tests/test_license.py |
Adds round-trip integration tests for CSV/JSON and mocked error/payload assertions (including fileInput multipart field name). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refs fossology#52. Adds LicenseEndpoint.export_licenses_csv() for GET /license/export-csv, the export counterpart to the merged import_licenses_csv() (fossology#185). Returns the exported licenses as CSV text and accepts an optional license id (0 = all). Verified against Fossology 4.4.0 (API 1.6.1) running in a container: an export->import round-trip test passes (idempotent), plus a mocked 403 error path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
fe441d9 to
a32535e
Compare
Contributor
Author
|
Superseded by #196. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #52.
Adds
LicenseEndpoint.export_licenses_csv()forGET /license/export-csv— the export counterpart to the mergedimport_licenses_csv()(#185). Returns the exported licenses as CSV text and accepts an optional licenseid(0= all).API details
Verified against Fossology 4.4.0 (API 1.6.1) running in a container.
Tests
export → importround-trip — passes live. Idempotent, and robust because the export output is exactly whatimport_licenses_csv()expects (no hand-crafted fixture that could drift from the server schema).403error path.ruffandmypypass; the export tests pass against a live fossology 4.4.0 container.🤖 Generated with Claude Code