aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuppie2026-09-03 18:17:45 -0600
committerstuppie2026-09-03 18:17:45 -0600
commit131c73789ac97a577cab9f19813fea28869d8992 (patch)
treeaf5bda39b388342c3e6b816070b94836540172ab
parentc9e1fc6839d8fc3ce145f65ad3c3c628af67626b (diff)
downloadgeneralresearch-131c73789ac97a577cab9f19813fea28869d8992.tar.gz
generalresearch-131c73789ac97a577cab9f19813fea28869d8992.zip
fix tests in tests/managers/thl/test_ledger
-rw-r--r--generalresearch/config.py4
-rw-r--r--tests/managers/thl/test_ledger/test_lm_tx.py2
-rw-r--r--tests/managers/thl/test_ledger/test_thl_lm_accounts.py7
-rw-r--r--tests/managers/thl/test_ledger/test_thl_lm_bp_payout.py13
-rw-r--r--tests/managers/thl/test_ledger/test_thl_pem.py13
-rw-r--r--tests/managers/thl/test_ledger/test_user_txs.py6
-rw-r--r--tests/managers/thl/test_ledger/test_wallet.py4
7 files changed, 15 insertions, 34 deletions
diff --git a/generalresearch/config.py b/generalresearch/config.py
index 2777aa4..75b9901 100644
--- a/generalresearch/config.py
+++ b/generalresearch/config.py
@@ -114,8 +114,8 @@ class GRLBaseSettings(BaseSettings):
tango_customer_id: str | None = Field(default=None)
# --- Keeping this here as we use these ids regardless of the AMT account
- amt_bonus_cashout_method_id: str | None = Field(default=None)
- amt_assignment_cashout_method_id: str | None = Field(default=None)
+ amt_bonus_cashout_method_id: str | None = Field(default="1951a47541fb46519827b8783e2a53ab")
+ amt_assignment_cashout_method_id: str | None = Field(default="5b23e4df3e2c40609ca8edf40b13237f")
# --- GRIP Configuration ---
grip_token: str | None = Field(default=None)
diff --git a/tests/managers/thl/test_ledger/test_lm_tx.py b/tests/managers/thl/test_ledger/test_lm_tx.py
index 445405e..025f6ac 100644
--- a/tests/managers/thl/test_ledger/test_lm_tx.py
+++ b/tests/managers/thl/test_ledger/test_lm_tx.py
@@ -117,7 +117,7 @@ class TestLedgerManagerCreateTx:
tx = ledger_manager.create_tx(entries=entries)
res = ledger_manager.get_tx_by_id(transaction_id=tx.id)
- assert ledger_manager.id == tx.id
+ assert res.id == tx.id
assert ledger_manager.get_account_balance(account=ledger_account_credit) == 100
assert ledger_manager.get_account_balance(account=ledger_account_debit) == 100
diff --git a/tests/managers/thl/test_ledger/test_thl_lm_accounts.py b/tests/managers/thl/test_ledger/test_thl_lm_accounts.py
index adff446..107ff00 100644
--- a/tests/managers/thl/test_ledger/test_thl_lm_accounts.py
+++ b/tests/managers/thl/test_ledger/test_thl_lm_accounts.py
@@ -172,14 +172,15 @@ class TestThlLedgerManagerAccounts:
thl_ledger_manager.get_account_task_complete_revenue()
def test_get_account_task_complete_revenue(
- self,
- thl_ledger_manager: ThlLedgerManager,
+ self, thl_ledger_manager: ThlLedgerManager, create_main_accounts
):
from generalresearch.models.thl.ledger import (
AccountType,
LedgerAccount,
)
+ create_main_accounts()
+
res = thl_ledger_manager.get_account_task_complete_revenue()
assert isinstance(res, LedgerAccount)
assert res.reference_type is None
@@ -201,7 +202,9 @@ class TestThlLedgerManagerAccounts:
def test_get_account_cash(
self,
thl_ledger_manager: ThlLedgerManager,
+ create_main_accounts
):
+ create_main_accounts()
from generalresearch.models.thl.ledger import (
AccountType,
LedgerAccount,
diff --git a/tests/managers/thl/test_ledger/test_thl_lm_bp_payout.py b/tests/managers/thl/test_ledger/test_thl_lm_bp_payout.py
index 14c5270..643731c 100644
--- a/tests/managers/thl/test_ledger/test_thl_lm_bp_payout.py
+++ b/tests/managers/thl/test_ledger/test_thl_lm_bp_payout.py
@@ -203,7 +203,7 @@ class TestThlLedgerManagerBPPayout:
# Test some basic assertions
with caplog.at_level(logging.INFO), pytest.raises(
- expected_exception=ValueError
+ expected_exception=LedgerTransactionConditionFailedError
):
thl_ledger_manager.create_tx_bp_payout(
product=product,
@@ -390,9 +390,6 @@ class TestPayoutEventManagerBPPayout:
product, rand_amount, now, direction=Direction.CREDIT
)
assert thl_ledger_manager.get_account_balance(bp_wallet_account) == rand_amount
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
pe = brokerage_product_payout_event_manager.create_bp_payout_event(
thl_ledger_manager=thl_ledger_manager,
@@ -427,12 +424,9 @@ class TestPayoutEventManagerBPPayout:
)
assert thl_ledger_manager.get_account_balance(bp_wallet_account) == 0
thl_ledger_manager.create_tx_plug_bp_wallet(
- product=product, amount=rand_amount, now=now, direction=Direction.CREDIT
+ product=product, amount=rand_amount, created=now, direction=Direction.CREDIT
)
assert thl_ledger_manager.get_account_balance(bp_wallet_account) == rand_amount
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
# Will fail on lock enter, no tx will actually get created
Lock.acquire = broken_acquire
@@ -552,9 +546,6 @@ class TestPayoutEventManagerBPPayout:
bp_wallet_account = thl_ledger_manager.get_account_or_create_bp_wallet(
product=product
)
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
assert thl_ledger_manager.get_account_balance(bp_wallet_account) == 0
thl_ledger_manager.create_tx_plug_bp_wallet(
diff --git a/tests/managers/thl/test_ledger/test_thl_pem.py b/tests/managers/thl/test_ledger/test_thl_pem.py
index 18102c3..fb35aa4 100644
--- a/tests/managers/thl/test_ledger/test_thl_pem.py
+++ b/tests/managers/thl/test_ledger/test_thl_pem.py
@@ -61,9 +61,6 @@ class TestThlPayoutEventManager:
product: Product = product_factory()
thl_ledger_manager.get_account_or_create_bp_wallet(product=product)
products.append(product)
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
for _ in range(N_PAYOUT_EVENTS):
pe = bp_payout_event_factory(product=product, usd_cent=usd_cent)
@@ -100,9 +97,6 @@ class TestThlPayoutEventManager:
product: Product = product_factory()
products.append(product)
thl_ledger_manager.get_account_or_create_bp_wallet(product=product)
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
for _ in range(N_PAYOUT_EVENTS):
pe = bp_payout_event_factory(product=product, usd_cent=usd_cent)
@@ -200,10 +194,6 @@ class TestThlPayoutEventManager:
account_bp_wallet = thl_ledger_manager.get_account_or_create_bp_wallet(
product=product
)
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
-
rand_amount = randint(a=99, b=999)
# Save a Brokerage Product Payout, so we have something in the
@@ -252,9 +242,6 @@ class TestBPPayoutEvent:
product: Product = product_factory()
thl_ledger_manager.get_account_or_create_bp_wallet(product=product)
- brokerage_product_payout_event_manager.set_account_lookup_table(
- thl_lm=thl_ledger_manager
- )
for _ in range(N_PAYOUT_EVENTS):
bp_payout_event_factory(product=product, usd_cent=usd_cent)
diff --git a/tests/managers/thl/test_ledger/test_user_txs.py b/tests/managers/thl/test_ledger/test_user_txs.py
index 1c08498..6b6ef5b 100644
--- a/tests/managers/thl/test_ledger/test_user_txs.py
+++ b/tests/managers/thl/test_ledger/test_user_txs.py
@@ -52,7 +52,7 @@ def test_user_txs(
s: Session = session_with_tx_factory(user=user, wall_req_cpi=Decimal("1.00"))
user_compensate(
- ledger_manager=ledger_manager,
+ ledger_manager=thl_ledger_manager,
user=user,
amount_int=100,
)
@@ -156,7 +156,7 @@ def test_user_txs_pagination(
for _ in range(12):
user_compensate(
- ledger_manager=ledger_manager,
+ ledger_manager=thl_ledger_manager,
user=user,
amount_int=100,
skip_flag_check=True,
@@ -189,7 +189,7 @@ def test_user_txs_pagination(
# Test filtering. We should pull back only this one
now = datetime.now(tz=UTC)
user_compensate(
- ledger_manager=ledger_manager,
+ ledger_manager=thl_ledger_manager,
user=user,
amount_int=100,
skip_flag_check=True,
diff --git a/tests/managers/thl/test_ledger/test_wallet.py b/tests/managers/thl/test_ledger/test_wallet.py
index dc1feec..0a1da73 100644
--- a/tests/managers/thl/test_ledger/test_wallet.py
+++ b/tests/managers/thl/test_ledger/test_wallet.py
@@ -56,7 +56,7 @@ class TestGetUserWalletBalance:
assert (
schrute_product.payout_config.payout_format == "{payout:,.0f} Schrute Bucks"
)
- user: User = user_factory(schrute_product)
+ user: User = user_factory(product=schrute_product)
balance = thl_ledger_manager.get_user_wallet_balance(user=user)
assert balance == 0
assert isinstance(user.product, Product)
@@ -78,7 +78,7 @@ class TestGetUserWalletBalance:
thl_ledger_manager: ThlLedgerManager,
session_with_tx_factory: Callable[..., None],
):
- user: User = user_factory(schrute_product)
+ user: User = user_factory(product=schrute_product)
thl_ledger_manager.create_tx_user_bonus(
user=user,
amount=Decimal(1),