feat: Enhance currency handling and validation across scenarios
- Updated form template to prefill currency input with default value and added help text for clarity. - Modified integration tests to assert more descriptive error messages for invalid currency codes. - Introduced new tests for currency normalization and validation in various scenarios, including imports and exports. - Added comprehensive tests for pricing calculations, ensuring defaults are respected and overrides function correctly. - Implemented unit tests for pricing settings repository, ensuring CRUD operations and default settings are handled properly. - Enhanced scenario pricing evaluation tests to validate currency handling and metadata defaults. - Added simulation tests to ensure Monte Carlo runs are accurate and handle various distribution scenarios.
This commit is contained in:
@@ -128,3 +128,17 @@ def test_scenario_export_excel(client: TestClient, unit_of_work_factory) -> None
|
||||
|
||||
with ZipFile(BytesIO(response.content)) as archive:
|
||||
assert "xl/workbook.xml" in archive.namelist()
|
||||
|
||||
|
||||
def test_scenario_export_rejects_invalid_currency_filter(client: TestClient) -> None:
|
||||
response = client.post(
|
||||
"/exports/scenarios",
|
||||
json={
|
||||
"format": "csv",
|
||||
"filters": {"currencies": ["USD", "XX"]},
|
||||
},
|
||||
)
|
||||
|
||||
assert response.status_code == 422
|
||||
detail = response.json()["detail"]
|
||||
assert "Invalid currency code" in detail
|
||||
|
||||
Reference in New Issue
Block a user