Skip to content

fix: rename duplicated function name and add missing route tests#89

Open
Aadik1ng wants to merge 1 commit into
Ensembl:mainfrom
Aadik1ng:fix/duplicated-function-metadata-api
Open

fix: rename duplicated function name and add missing route tests#89
Aadik1ng wants to merge 1 commit into
Ensembl:mainfrom
Aadik1ng:fix/duplicated-function-metadata-api

Conversation

@Aadik1ng
Copy link
Copy Markdown

Description

This PR fixes a copy-paste error in app/api/resources/metadata.py where the function name get_genome_ftplinks was mistakenly reused across two different routes.

The function associated with the region checksum route has been renamed to get_region_checksum to align with its decorator and intended functionality.

Changes Made

  • Renamed the duplicated function to get_region_checksum for:
    • Improved code clarity
    • More accurate tracebacks
    • Correct Swagger/OpenAPI documentation
  • Added basic test coverage in test_metadata.py:
    • test_region_checksum_route ensures the checksum route responds correctly (even if gRPC is unavailable), preventing silent 404s
    • test_vep_file_paths_route verifies correct route mapping for VEP file paths
  • Reformatted modified files using Black to maintain project style consistency

Route Fix

  • GET /genome/{genome_uuid}/checksum/{region_name} now correctly maps to get_region_checksum (previously incorrectly mapped to get_genome_ftplinks)

Testing

  • Added tests to validate:
    • Route-to-handler mapping
    • Non-404 responses for valid endpoints

Checklist

  • Code formatted with Black
  • Tests added

- Renamed duplicated 'get_genome_ftplinks' to 'get_region_checksum'
- Added basic test cases for checksum and VEP file paths routes to verify mapping
- Re-formatted files with Black
@Aadik1ng
Copy link
Copy Markdown
Author

@andrewyatz please review

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