Commit cd9e330
test: add comprehensive tests for well inventory CSV upload
Add 33 new tests to improve coverage of well inventory CSV functionality:
Error Handling Tests (17):
- Invalid file type, empty file, headers only
- Duplicate columns/well IDs, missing required fields
- Invalid date/numeric/email/phone formats
- Invalid UTM coordinates, lexicon values, boolean values
- Missing contact type/role, partial water level fields
- Non-UTF8 encoding
Unit Tests for Helper Functions (11):
- _make_location() with UTM zones 13N and 12N
- _make_contact() with full info and empty name
- _make_well_permission() success and error cases
- generate_autogen_well_id() various scenarios
- AUTOGEN_REGEX pattern matching
API Edge Case Tests (6):
- Too many rows (>2000)
- Semicolon and tab delimiters
- Duplicate header row in data
- Valid CSV with comma in quoted fields
- Non-numeric well ID suffix handling
Coverage improvement:
- api/well_inventory.py: 14% → 68%
- schemas/well_inventory.py: 61% → 90%
- Total: 43% → 79%
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 4f751a3 commit cd9e330
1 file changed
Lines changed: 520 additions & 0 deletions
0 commit comments