Add and fix tests
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from decimal import Decimal
|
||||
|
||||
from sqlalchemy import create_engine, select
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
@@ -40,10 +41,12 @@ def ensure_user(user_info: dict, session: Session) -> User:
|
||||
session.add(user)
|
||||
session.flush()
|
||||
|
||||
if not "APS_PRODUCTION_MODE" in os.environ:
|
||||
if not "APS_PRODUCTION_MODE" in os.environ and not "APS_TESTRUN" in os.environ:
|
||||
# when in demo mode each user gets an account with some starting balance
|
||||
account = Account(name=f"Demokonto für {user.display_name}")
|
||||
account.transactions.append(Transaction(total_amount=100.0, type="deposit"))
|
||||
account.transactions.append(
|
||||
Transaction(total_amount=Decimal(100), type="deposit")
|
||||
)
|
||||
user.accounts.append(account)
|
||||
session.flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user