Extract price logic to PriceService

- Create PriceService with get_recent_prices() and fetch_and_store_price()
- Update routes/audit.py to use PriceService instead of direct queries
- Use PriceHistoryMapper consistently
- Update test to patch services.price.fetch_btc_eur_price
This commit is contained in:
counterweight 2025-12-25 18:30:26 +01:00
parent 168b67acee
commit badb45da59
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 324 additions and 50 deletions

View file

@ -280,7 +280,7 @@ class TestManualFetch:
existing_id = existing.id
# Mock fetch_btc_eur_price to return the same timestamp
with patch("routes.audit.fetch_btc_eur_price") as mock_fetch:
with patch("services.price.fetch_btc_eur_price") as mock_fetch:
mock_fetch.return_value = (95000.0, fixed_timestamp)
async with client_factory.create(cookies=admin_user["cookies"]) as authed: