From 967eb761c414e22c7567d0f594ae7a7bc6e3e62c Mon Sep 17 00:00:00 2001 From: stuppie Date: Mon, 7 Sep 2026 09:57:06 -0600 Subject: Leaderboard name and id are optional b/c they get set by validator. can't init the class otherwise. Fix tests. test_leaderboard_manager datetime is not supposed to have a timzeone; that is the point of the test --- tests/managers/leaderboard.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tests/managers/leaderboard.py') diff --git a/tests/managers/leaderboard.py b/tests/managers/leaderboard.py index 197477b..fad0b6b 100644 --- a/tests/managers/leaderboard.py +++ b/tests/managers/leaderboard.py @@ -83,7 +83,8 @@ def _create_session( @pytest.fixture(scope="function") -def setup_leaderboards(thl_redis: RedisConfig) -> Callable[..., None]: +def setup_leaderboards(thl_redis_config: RedisConfig) -> Callable[..., None]: + thl_redis = thl_redis_config.create_redis_client() def _inner(): complete_count = { @@ -138,10 +139,10 @@ def setup_leaderboards(thl_redis: RedisConfig) -> Callable[..., None]: class TestLeaderboards: - def test_leaderboard_manager( - self, setup_leaderboards: Callable[..., None], thl_redis: RedisConfig + self, setup_leaderboards: Callable[..., None], thl_redis_config: RedisConfig ): + thl_redis = thl_redis_config.create_redis_client() setup_leaderboards() country_iso = "us" @@ -153,7 +154,8 @@ class TestLeaderboards: freq=freq, product_id=product_id, country_iso=country_iso, - within_time=datetime(2025, 2, 5, 0, 0, 0, tzinfo=UTC), + # This is supposed to not have a timezone. @max don't change it + within_time=datetime(2025, 2, 5, 0, 0, 0), ) lb = m.get_leaderboard() assert lb.period_start_local == datetime( @@ -182,8 +184,9 @@ class TestLeaderboards: ] def test_leaderboard_manager_bpuid( - self, setup_leaderboards: Callable[..., None], thl_redis: RedisConfig + self, setup_leaderboards: Callable[..., None], thl_redis_config: RedisConfig ): + thl_redis = thl_redis_config.create_redis_client() setup_leaderboards() country_iso = "us" @@ -216,8 +219,9 @@ class TestLeaderboards: self, setup_leaderboards: Callable[..., None], session_factory: Callable[..., Session], - thl_redis: RedisConfig, + thl_redis_config: RedisConfig, ): + thl_redis = thl_redis_config.create_redis_client() setup_leaderboards() hit_leaderboards(redis_client=thl_redis, session=session_factory()) @@ -265,8 +269,9 @@ class TestLeaderboards: self, setup_leaderboards: Callable[..., None], session_factory: Callable[..., None], - thl_redis: RedisConfig, + thl_redis_config: RedisConfig, ): + thl_redis = thl_redis_config.create_redis_client() setup_leaderboards() session = session_factory(product_user_id="zzz") @@ -283,7 +288,8 @@ class TestLeaderboards: assert lb.row_count == 8 assert LeaderboardRow(bpuid="zzz", value=1, rank=6) in lb.rows - def test_leaderboard_country(self, thl_redis: RedisConfig): + def test_leaderboard_country(self, thl_redis_config: RedisConfig): + thl_redis = thl_redis_config.create_redis_client() m = LeaderboardManager( redis_client=thl_redis, board_code=LeaderboardCode.COMPLETE_COUNT, -- cgit v1.2.3