Skip to content

Commit c9d1305

Browse files
committed
test: update test for blank well_name_point_id to auto-generate IDs
1 parent 3b7c561 commit c9d1305

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

tests/test_well_inventory.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,24 @@ def test_upload_duplicate_well_ids(self):
480480
errors = result.payload.get("validation_errors", [])
481481
assert any("Duplicate" in str(e) for e in errors)
482482

483-
def test_upload_blank_well_name_point_id_autogenerates(self):
483+
def test_upload_blank_well_name_point_id_autogenerates(self, tmp_path):
484484
"""Upload succeeds when well_name_point_id is blank and auto-generates IDs."""
485-
file_path = Path("tests/features/data/well-inventory-missing-required.csv")
486-
if file_path.exists():
485+
source_path = Path("tests/features/data/well-inventory-valid.csv")
486+
if source_path.exists():
487+
with open(source_path, "r", encoding="utf-8", newline="") as rf:
488+
reader = csv.DictReader(rf)
489+
rows = list(reader)
490+
fieldnames = reader.fieldnames
491+
492+
for row in rows:
493+
row["well_name_point_id"] = ""
494+
495+
file_path = tmp_path / "well-inventory-blank-point-id.csv"
496+
with open(file_path, "w", encoding="utf-8", newline="") as wf:
497+
writer = csv.DictWriter(wf, fieldnames=fieldnames)
498+
writer.writeheader()
499+
writer.writerows(rows)
500+
487501
result = well_inventory_csv(file_path)
488502
assert result.exit_code == 0
489503

0 commit comments

Comments
 (0)