diff options
| author | stuppie | 2026-09-08 11:42:46 -0600 |
|---|---|---|
| committer | stuppie | 2026-09-08 11:42:46 -0600 |
| commit | 70e2024b3b8abdf3965f59545aa35fda6270de1d (patch) | |
| tree | e25cd8ec5ac74b301f0282ed5a6a359f3450c112 | |
| parent | 7b2f48152109ed17b88886ce3a53fbdc3bedb0ac (diff) | |
| download | generalresearch-70e2024b3b8abdf3965f59545aa35fda6270de1d.tar.gz generalresearch-70e2024b3b8abdf3965f59545aa35fda6270de1d.zip | |
user manager fixture add permissions; some stuff actually checks this. Add user and product fixture with failed attempt credit
| -rw-r--r-- | test_utils/managers/thl/conftest.py | 1 | ||||
| -rw-r--r-- | test_utils/models/conftest.py | 16 | ||||
| -rw-r--r-- | test_utils/models/thl/conftest.py | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/test_utils/managers/thl/conftest.py b/test_utils/managers/thl/conftest.py index 355a39d..3392559 100644 --- a/test_utils/managers/thl/conftest.py +++ b/test_utils/managers/thl/conftest.py @@ -225,6 +225,7 @@ def user_manager( pg_config=thl_web_rw, pg_config_rr=thl_web_rr, redis=settings.redis, + sql_permissions=[Permission.CREATE, Permission.UPDATE, Permission.READ], ) # rc = thl_redis_config.create_redis_client() diff --git a/test_utils/models/conftest.py b/test_utils/models/conftest.py index ffce272..7f82f69 100644 --- a/test_utils/models/conftest.py +++ b/test_utils/models/conftest.py @@ -1,6 +1,7 @@ from __future__ import annotations from collections.abc import Callable +from decimal import Decimal from typing import TYPE_CHECKING from uuid import uuid4 @@ -76,6 +77,21 @@ def product_amt_true( ) +@pytest.fixture +def product_failed_attempt_credit( + product_factory: Callable[..., Product], + payout_config: PayoutConfig, +) -> Product: + from generalresearch.models.thl.product import UserWalletConfig + + return product_factory( + user_wallet_config=UserWalletConfig( + enabled=True, failed_attempt_credit=Decimal("0.05") + ), + payout_config=payout_config, + ) + + @pytest.fixture(scope="session") def buyer(buyer_manager: BuyerManager) -> Buyer: buyer_code = uuid4().hex diff --git a/test_utils/models/thl/conftest.py b/test_utils/models/thl/conftest.py index e09eadd..d20fdc4 100644 --- a/test_utils/models/thl/conftest.py +++ b/test_utils/models/thl/conftest.py @@ -700,6 +700,14 @@ def user_with_wallet_amt( return user_factory(save=True, product=product_amt_true) +@pytest.fixture +def user_failed_attempt_credit( + user_factory: Callable[..., User], product_failed_attempt_credit: Product +) -> User: + # A user on a product with user wallet enabled, failed_attempt_credit enabled + return user_factory(save=True, product=product_failed_attempt_credit) + + # --- User Payout Event --- |
