Skip to content

Update skipped tests in test_thing.py to match current API response schema #437

@kbighorse

Description

@kbighorse

Summary

There are 14 skipped tests in tests/test_thing.py that need to be updated to match the current API response schema.

Problem

The tests were skipped with the message "Needs to be updated per changes made from feature files". Investigation revealed:

  1. Required fields changed: CreateWell now requires measuring_point_height and is_suitable_for_datalogger fields
  2. Response format changed: current_location is now returned as GeoJSON (LocationGeoJSONResponse) instead of flat LocationResponse
  3. Fields removed: well_construction_notes is no longer in the response schema

Tests to Update

POST tests (need new required fields + response updates)

  • test_add_water_well
  • test_add_water_well_with_measuring_point
  • test_add_water_well_409_bad_group_id
  • test_add_water_well_409_bad_location_id
  • test_add_spring
  • test_add_spring_409_bad_group_id
  • test_add_spring_409_bad_location_id

GET tests (need response schema updates)

  • test_get_water_wells
  • test_get_water_well_by_id (also covered by feature files)
  • test_get_springs
  • test_get_spring_by_id
  • test_get_thing_by_id

PATCH tests (need response schema updates)

  • test_patch_water_well
  • test_patch_spring

Required Changes

  1. Add measuring_point_height and is_suitable_for_datalogger to well creation payloads
  2. Update assertions to use GeoJSON format for current_location:
    # Old format
    assert data["current_location"] == LocationResponse.model_validate(location).model_dump(mode="json")
    
    # New format (GeoJSON Feature)
    assert data["current_location"]["type"] == "Feature"
    assert data["current_location"]["geometry"]["type"] == "Point"
  3. Remove assertions for well_construction_notes (no longer in response)
  4. Update field assertions to match current WellResponse/SpringResponse schemas

Related

  • Some of these tests may overlap with BDD feature tests in tests/features/

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions