Skip to content

feat(license): wrap GET /license/export-csv endpoint#196

Open
Valyrian-Code wants to merge 2 commits into
fossology:mainfrom
Valyrian-Code:feat/license-csv-export
Open

feat(license): wrap GET /license/export-csv endpoint#196
Valyrian-Code wants to merge 2 commits into
fossology:mainfrom
Valyrian-Code:feat/license-csv-export

Conversation

@Valyrian-Code

Copy link
Copy Markdown
Contributor

Refs #52.

Adds LicenseEndpoint.export_licenses_csv() for GET /license/export-csv — the export counterpart to the merged import_licenses_csv() (#185). Returns the exported licenses as CSV text and accepts an optional license id (0 = all).

API details

Verified against Fossology 4.4.0 (API 1.6.1) running in a container.

Tests

  • export → import round-trip — passes live. Idempotent, and robust because the export output is exactly what import_licenses_csv() expects.
  • Mocked 403 error path.

ruff and mypy pass; the export tests pass against a live fossology 4.4.0 container.

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.

Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
Copilot AI review requested due to automatic review settings July 1, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@deveaud-m

Copy link
Copy Markdown
Collaborator

@Valyrian-Code thanks again for the PR.

Could you also add a test to verify that single license can also be exported using the "id" parameter?

And verify that the exported csv the expected number of licenses contains?

Add two tests requested during review of fossology#196:

- export a single license with export_licenses_csv(id) and assert the CSV
  contains exactly that one license (header row + one data row)
- assert the full export (no id) returns more than one license

Verified live against Fossology 4.4.0 (API 1.6.1).

Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Thanks @deveaud-m! Added in a213d69:

  • test_export_single_license_by_id — exports a single license via the id parameter and asserts the CSV contains exactly that one license (header row + one data row).
  • test_export_all_licenses_returns_more_than_one — asserts the full export (no id) returns more than a single license.

Both verified live against a Fossology 4.4.0 container.

One note on "expected number": I did not assert the full-export row count against list_licenses(), because export-csv returns a broader set than the paginated license list (871 rows vs 779 from list_licenses(all_pages=True) on 4.4.0), so an exact-equality check would be misleading. The single-license export is asserted exactly (1 row).

@Valyrian-Code

Valyrian-Code commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Hi @deveaud-m, thanks again for the reviews on these.

Most of what I've sent has been merged now: the report endpoints (#178, #184), the license CSV import (#185), and the upload analysis + agents endpoints (#197, #198). I'd like to get more involved in fossology-python beyond sending the occasional PR.

Happy to help with:

  • larger features or refactors
  • issue triage
  • reviewing other contributors' PRs

Is there a good way to get more regularly involved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants