Step 8: Cleanup old constants

- Remove EUR_TRADE_MIN, EUR_TRADE_MAX, PREMIUM_PERCENTAGE from shared_constants.py
- Remove eurTradeMin, eurTradeMax, premiumPercentage from shared/constants.json
- Update validate_constants.py to not require removed fields
- Update seed.py and seed_e2e.py to use defaults if fields don't exist
- Update tests to handle missing constants gracefully
This commit is contained in:
counterweight 2025-12-26 20:27:03 +01:00
parent 41e158376c
commit 549fbf4975
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
6 changed files with 20 additions and 25 deletions

View file

@ -176,10 +176,11 @@ class TestPricingSeeding:
with constants_path.open() as f:
constants = json.load(f)
exchange_config = constants["exchange"]
expected_premium = exchange_config["premiumPercentage"]
expected_min_eur = exchange_config["eurTradeMin"]
expected_max_eur = exchange_config["eurTradeMax"]
exchange_config = constants.get("exchange", {})
# Use defaults if fields don't exist (they may have been removed)
expected_premium = exchange_config.get("premiumPercentage", 5)
expected_min_eur = exchange_config.get("eurTradeMin", 100)
expected_max_eur = exchange_config.get("eurTradeMax", 3000)
async with client_factory.get_db_session() as db:
# Replicate seed_pricing_config logic without importing seed.py
@ -217,10 +218,11 @@ class TestPricingSeeding:
with constants_path.open() as f:
constants = json.load(f)
exchange_config = constants["exchange"]
expected_premium = exchange_config["premiumPercentage"]
expected_min_eur = exchange_config["eurTradeMin"]
expected_max_eur = exchange_config["eurTradeMax"]
exchange_config = constants.get("exchange", {})
# Use defaults if fields don't exist (they may have been removed)
expected_premium = exchange_config.get("premiumPercentage", 5)
expected_min_eur = exchange_config.get("eurTradeMin", 100)
expected_max_eur = exchange_config.get("eurTradeMax", 3000)
async with client_factory.get_db_session() as db:
repo = PricingRepository(db)