diff options
Diffstat (limited to 'tests/managers/thl/test_ledger')
| -rw-r--r-- | tests/managers/thl/test_ledger/test_thl_pem.py | 4 | ||||
| -rw-r--r-- | tests/managers/thl/test_ledger/test_wallet.py | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/managers/thl/test_ledger/test_thl_pem.py b/tests/managers/thl/test_ledger/test_thl_pem.py index ddf9bc9..3d6fa87 100644 --- a/tests/managers/thl/test_ledger/test_thl_pem.py +++ b/tests/managers/thl/test_ledger/test_thl_pem.py @@ -11,6 +11,7 @@ from generalresearch.currency import USDCent from generalresearch.models.thl.payout import ( BrokerageProductPayoutEvent, ) +from generalresearch.models.thl.user import User if TYPE_CHECKING: from generalresearch.managers.thl.ledger_manager.ledger import LedgerManager @@ -135,11 +136,12 @@ class TestThlPayoutEventManager: self, user_payout_event_factory: Callable[..., UserPayoutEvent], user_payout_event_manager: UserPayoutEventManager, + user: User ): from generalresearch.models.thl.payout import UserPayoutEvent # Confirm the creation method returns back an instance. - pe = user_payout_event_factory() + pe = user_payout_event_factory(user=user) assert isinstance(pe, UserPayoutEvent) # Now query the DB for that PayoutEvent to confirm it was actually diff --git a/tests/managers/thl/test_ledger/test_wallet.py b/tests/managers/thl/test_ledger/test_wallet.py index f154c19..a4ec052 100644 --- a/tests/managers/thl/test_ledger/test_wallet.py +++ b/tests/managers/thl/test_ledger/test_wallet.py @@ -38,6 +38,10 @@ def schrute_product( class TestGetUserWalletBalance: + @pytest.fixture(autouse=True) + def setup(self, create_main_accounts): + create_main_accounts() + def test_get_user_wallet_balance_non_managed( self, user: User, thl_ledger_manager: ThlLedgerManager ): @@ -98,4 +102,7 @@ class TestGetUserWalletBalance: user=user, user_wallet_balance=balance ) assert redeemable_balance == 20 + 100 - assert thl_ledger_manager.get_user_cashout_balance(user=user) == 20 + 100 + + # The cashout balance depends on the product.user_wallet_config.balance_type + assert user.product.user_wallet_config.balance_type == "wallet_balance" + assert thl_ledger_manager.get_user_cashout_balance(user=user) == 147 |
