aboutsummaryrefslogtreecommitdiff
path: root/tests/models/thl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/models/thl')
-rw-r--r--tests/models/thl/test_contest/test_leaderboard_contest.py8
-rw-r--r--tests/models/thl/test_payout_format.py8
-rw-r--r--tests/models/thl/test_product.py21
3 files changed, 8 insertions, 29 deletions
diff --git a/tests/models/thl/test_contest/test_leaderboard_contest.py b/tests/models/thl/test_contest/test_leaderboard_contest.py
index c49776b..f787bdf 100644
--- a/tests/models/thl/test_contest/test_leaderboard_contest.py
+++ b/tests/models/thl/test_contest/test_leaderboard_contest.py
@@ -33,7 +33,7 @@ class TestLeaderboardContest(TestContest):
@pytest.fixture
def leaderboard_contest(
- self, product: Product, thl_redis: Redis, user_manager: UserManager
+ self, product: Product, thl_redis_client: Redis, user_manager: UserManager
) -> LeaderboardContest:
board_key = f"leaderboard:{product.uuid}:us:weekly:2025-05-26:complete_count"
@@ -67,14 +67,14 @@ class TestLeaderboardContest(TestContest):
),
],
)
- c._redis_client = thl_redis
+ c._redis_client = thl_redis_client
c._user_manager = user_manager
return c
def test_init(
self,
leaderboard_contest: LeaderboardContest,
- thl_redis: Redis,
+ thl_redis_client: Redis,
user_1: User,
user_2: User,
):
@@ -82,7 +82,7 @@ class TestLeaderboardContest(TestContest):
assert leaderboard_contest.end_condition.ends_at is not None
lbm = LeaderboardManager(
- redis_client=thl_redis,
+ redis_client=thl_redis_client,
board_code=model.board_code,
country_iso=model.country_iso,
freq=model.freq,
diff --git a/tests/models/thl/test_payout_format.py b/tests/models/thl/test_payout_format.py
index 56eafe3..fe7aea5 100644
--- a/tests/models/thl/test_payout_format.py
+++ b/tests/models/thl/test_payout_format.py
@@ -1,20 +1,14 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
import pytest
from pydantic import BaseModel
from generalresearch.models.thl.payout_format import (
PayoutFormatField,
+ PayoutFormatType,
format_payout_format,
)
-if TYPE_CHECKING:
- from generalresearch.models.thl.payout_format import (
- PayoutFormatType,
- )
-
class PayoutFormatTestClass(BaseModel):
payout_format: PayoutFormatType = PayoutFormatField
diff --git a/tests/models/thl/test_product.py b/tests/models/thl/test_product.py
index 223430f..25affcf 100644
--- a/tests/models/thl/test_product.py
+++ b/tests/models/thl/test_product.py
@@ -48,7 +48,6 @@ if TYPE_CHECKING:
class TestProduct:
-
def test_init(self):
# By default, just a Pydantic instance doesn't have an id_int
instance = Product.model_validate(
@@ -70,13 +69,13 @@ class TestProduct:
# By default, just a Pydantic instance doesn't have an id_int
instance = product_factory()
assert isinstance(instance.id_int, int)
+ assert isinstance(instance, Product)
res = instance.model_dump_json()
- assert isinstance(res, Product)
# we json skip & exclude
- res = instance.model_dump()
- assert isinstance(res, Product)
+ p = Product.model_validate_json(res)
+ assert isinstance(p, Product)
def test_redirect_url(self):
p = Product.model_validate(
@@ -150,12 +149,6 @@ class TestProduct:
redirect_url="https://www.google.com/hey",
)
- assert isinstance(p.payout_config.payout_transformation, PayoutTransformation)
- assert isinstance(
- p.payout_config.payout_transformation.kwargs,
- PayoutTransformationPercentArgs,
- )
-
p.payout_config.payout_transformation = PayoutTransformation.model_validate(
{
"f": "payout_transformation_percent",
@@ -598,7 +591,6 @@ class TestGlobalProductConfigFor:
class TestProductFinancials:
-
@pytest.fixture
def start(self) -> datetime:
return datetime(year=2018, month=3, day=14, hour=0, tzinfo=UTC)
@@ -639,7 +631,6 @@ class TestProductFinancials:
u1: User = user_factory(product=p1)
bp_wallet = thl_ledger_manager.get_account_or_create_bp_wallet(product=p1)
thl_ledger_manager.get_account_or_create_user_wallet(user=u1)
- brokerage_product_payout_event_manager.set_account_lookup_table(thl_lm=thl_lm)
assert (
len(
@@ -818,7 +809,6 @@ class TestProductFinancials:
class TestProductBalance:
-
@pytest.fixture
def start(self) -> datetime:
return datetime(year=2018, month=3, day=14, hour=0, tzinfo=UTC)
@@ -867,7 +857,6 @@ class TestProductBalance:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
# 2. Payout and build Parquets 2nd time
- payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
brokerage_product_payout_event_factory(
product=product,
amount=USDCent(71),
@@ -928,7 +917,6 @@ class TestProductBalance:
# 2. Payout and build Parquets 2nd time but this payout is "now"
# so it hasn't already been archived
- payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
brokerage_product_payout_event_factory(
product=product,
amount=USDCent(71),
@@ -947,7 +935,6 @@ class TestProductBalance:
class TestProductPOPFinancial:
-
@pytest.fixture
def start(self) -> datetime:
return datetime(year=2018, month=3, day=14, hour=0, tzinfo=UTC)
@@ -1020,7 +1007,6 @@ class TestProductPOPFinancial:
class TestProductCache:
-
@pytest.fixture
def start(self) -> datetime:
return datetime(year=2018, month=3, day=14, hour=0, tzinfo=UTC)
@@ -1143,7 +1129,6 @@ class TestProductCache:
)
# 2. Payout
- payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
brokerage_product_payout_event_factory(
product=product,
amount=USDCent(71),