Skip to content

feat: add optional ?server=local/pre_ckan to DELETE /organization/{organization_name}#45

Merged
rbardaji merged 4 commits intomainfrom
feat/delete-organization-server-queryparam
Mar 2, 2025
Merged

feat: add optional ?server=local/pre_ckan to DELETE /organization/{organization_name}#45
rbardaji merged 4 commits intomainfrom
feat/delete-organization-server-queryparam

Conversation

@rbardaji
Copy link
Copy Markdown
Collaborator

@rbardaji rbardaji commented Mar 2, 2025

This pull request adds an optional server query parameter to the
DELETE /organization/{organization_name} endpoint, allowing users
to delete organizations from either the local CKAN or a pre-CKAN instance.
It also aligns the test suite with the new behavior, including the
404 status code for non-existent organizations.

Changes

  1. Added a ckan_instance parameter in delete_organization to avoid relying
    solely on ckan_settings.ckan.
  2. Implemented ?server=local or ?server=pre_ckan in the DELETE /organization
    route.
  3. Returns a 400 error if pre_ckan is disabled or missing a valid URL scheme.
  4. Returns 404 if the organization does not exist.
  5. Updated tests/test_delete_organization.py to:
    • Use ANY to ignore the ckan_instance parameter.
    • Expect a 404 status code for "Organization not found."

Impact

  • Users can explicitly select which CKAN instance to delete an organization
    from.
  • Maintains backward compatibility by defaulting to local CKAN if the server
    parameter is omitted.
  • Provides user-friendly error messages for disabled or misconfigured
    pre_ckan.
  • The tests now correctly handle the new 404 vs. 400 behavior.

Testing

  • Verified locally that ?server=pre_ckan calls delete_organization with
    pre_ckan, returning 400 if disabled or "No scheme supplied."
  • Confirmed that calls without ?server remain on local CKAN.
  • The test suite now passes with the updated expectations.

@rbardaji rbardaji merged commit eafb721 into main Mar 2, 2025
@rbardaji rbardaji deleted the feat/delete-organization-server-queryparam branch March 2, 2025 02:03
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.

1 participant