Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for various GeoJSON configurations and CRS validation #1726

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

azharcodeit
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Related to Issue #1613

Describe this PR

This PR implements various tests and enhancements for GeoJSON configurations during project creation:

Added tests for different GeoJSON types during project creation

  • Ensured support for Polygon and MultiPolygon, both as standalone and within Feature or FeatureCollection
  • Added error responses for unsupported GeoJSON types: LineString, MultiLineString, Point, MultiPoint
  • Included tests for rejecting unsupported CRS in GeoJSON

Refactored project creation tests

  • Extracted sample project data to a fixture for reusability

Screenshots

Screenshot 2024-08-01 at 14 42 54

Alternative Approaches Considered

Will cover separately:

  • GeometryCollection type for GeoJSON
  • Hashtags

Review Guide

Command to run all tests defined in the project using pytest:

docker compose run --rm api pytest

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

# Duplicate response to test error condition: project name already exists
response_duplicate = client.post(
f"/projects/create-project?org_id={organisation.id}", json=project_data
)
Copy link
Member

Choose a reason for hiding this comment

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

πŸŽ‰

Copy link
Member

@spwoodcock spwoodcock left a comment

Choose a reason for hiding this comment

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

This is a really nice PR! Great work πŸ˜„

@spwoodcock spwoodcock merged commit 7a52494 into hotosm:development Aug 5, 2024
4 of 5 checks passed
@spwoodcock spwoodcock added the tests Related to automated code tests label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code tests Related to automated code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants