Update constants validation to check bitcoinTransferMethods and lightningMaxEur
This commit is contained in:
parent
819bb2dd03
commit
cecb8b33a7
1 changed files with 11 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ from pathlib import Path
|
||||||
from models import (
|
from models import (
|
||||||
ROLE_ADMIN,
|
ROLE_ADMIN,
|
||||||
ROLE_REGULAR,
|
ROLE_REGULAR,
|
||||||
|
BitcoinTransferMethod,
|
||||||
ExchangeStatus,
|
ExchangeStatus,
|
||||||
InviteStatus,
|
InviteStatus,
|
||||||
TradeDirection,
|
TradeDirection,
|
||||||
|
|
@ -59,6 +60,15 @@ def validate_shared_constants() -> None:
|
||||||
f"Expected: {expected_trade_directions}, Got: {got}"
|
f"Expected: {expected_trade_directions}, Got: {got}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Validate bitcoin transfer methods
|
||||||
|
expected_transfer_methods = {m.name: m.value for m in BitcoinTransferMethod}
|
||||||
|
if constants.get("bitcoinTransferMethods") != expected_transfer_methods:
|
||||||
|
got = constants.get("bitcoinTransferMethods")
|
||||||
|
raise ValueError(
|
||||||
|
f"Bitcoin transfer method mismatch. "
|
||||||
|
f"Expected: {expected_transfer_methods}, Got: {got}"
|
||||||
|
)
|
||||||
|
|
||||||
# Validate exchange constants exist with required fields
|
# Validate exchange constants exist with required fields
|
||||||
exchange = constants.get("exchange", {})
|
exchange = constants.get("exchange", {})
|
||||||
required_exchange_fields = [
|
required_exchange_fields = [
|
||||||
|
|
@ -71,6 +81,7 @@ def validate_shared_constants() -> None:
|
||||||
"premiumPercentage",
|
"premiumPercentage",
|
||||||
"priceRefreshSeconds",
|
"priceRefreshSeconds",
|
||||||
"priceStalenessSeconds",
|
"priceStalenessSeconds",
|
||||||
|
"lightningMaxEur",
|
||||||
]
|
]
|
||||||
for field in required_exchange_fields:
|
for field in required_exchange_fields:
|
||||||
if field not in exchange:
|
if field not in exchange:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue