From 3338f74a94d0624bf894ebb35bd1bcfca268216e Mon Sep 17 00:00:00 2001 From: stuppie Date: Mon, 7 Sep 2026 11:12:04 -0600 Subject: fix more tests. Fix survey score optional field --- test_utils/models/gr/conftest.py | 37 +++++++++++++------------------------ test_utils/models/thl/conftest.py | 12 ++++++------ 2 files changed, 19 insertions(+), 30 deletions(-) (limited to 'test_utils') diff --git a/test_utils/models/gr/conftest.py b/test_utils/models/gr/conftest.py index 859aaa4..f5dcaa1 100644 --- a/test_utils/models/gr/conftest.py +++ b/test_utils/models/gr/conftest.py @@ -91,7 +91,6 @@ def gr_business_address_factory( def _inner( business_id: PositiveInt, - save: bool = True, uuid: UUIDStr | None = None, line_1: str | None = None, line_2: str | None = None, @@ -110,36 +109,26 @@ def gr_business_address_factory( phone_number = None country = country or "US" - if save: - return gr_business_address_manager.create( - business_id=business_id, - uuid=uuid, - line_1=line_1, - line_2=line_2, - city=city, - state=state, - postal_code=postal_code, - phone_number=phone_number, - country=country, - ) - else: - raise ValueError("Unsaved BusinessAddress not supported yet") + return gr_business_address_manager.create( + business_id=business_id, + uuid=uuid, + line_1=line_1, + line_2=line_2, + city=city, + state=state, + postal_code=postal_code, + phone_number=phone_number, + country=country, + ) return _inner @pytest.fixture def gr_business_address( - gr_business_address_factory: Callable[..., BusinessAddress], -) -> BusinessAddress: - return gr_business_address_factory(save=True) - - -@pytest.fixture -def unsaved_gr_business_address( - gr_business_address_factory: Callable[..., BusinessAddress], + gr_business_address_factory: Callable[..., BusinessAddress], gr_business: Business ) -> BusinessAddress: - return gr_business_address_factory(save=False) + return gr_business_address_factory(business_id=gr_business.id) # --- Business --- diff --git a/test_utils/models/thl/conftest.py b/test_utils/models/thl/conftest.py index 376891c..e09eadd 100644 --- a/test_utils/models/thl/conftest.py +++ b/test_utils/models/thl/conftest.py @@ -14,7 +14,10 @@ from grip_client.enums import AccessType from pydantic import PositiveInt from generalresearch.currency import USDCent -from generalresearch.managers.thl.payout import UserPayoutEventManager +from generalresearch.managers.thl.payout import ( + BusinessPayoutEventManager, + UserPayoutEventManager, +) from generalresearch.models.custom_types import ( AwareDatetimeISO, IPvAnyAddressStr, @@ -38,9 +41,6 @@ if TYPE_CHECKING: IPInformationManager, ) from generalresearch.managers.thl.ledger_manager.thl_ledger import ThlLedgerManager - from generalresearch.managers.thl.payout import ( - BrokerageProductPayoutEventManager, - ) from generalresearch.managers.thl.product import ProductManager from generalresearch.managers.thl.session import SessionManager from generalresearch.managers.thl.user_manager.user_manager import UserManager @@ -777,7 +777,7 @@ def unsaved_user_payout_event( @pytest.fixture def brokerage_product_payout_event_factory( thl_ledger_manager: ThlLedgerManager, - brokerage_product_payout_event_manager: BrokerageProductPayoutEventManager, + business_payout_event_manager: BusinessPayoutEventManager, product_factory: Callable[..., Product], ) -> Callable[..., BrokerageProductPayoutEvent]: @@ -791,7 +791,7 @@ def brokerage_product_payout_event_factory( product = product or product_factory() amount = amount or USDCent(randint(1, 99_99)) - return brokerage_product_payout_event_manager.create_bp_payout_event( + return business_payout_event_manager.create_bp_payout_event( thl_ledger_manager=thl_ledger_manager, product=product, amount=amount, -- cgit v1.2.3