diff options
| author | Max Nanis | 2026-09-13 19:03:55 +0000 |
|---|---|---|
| committer | Max Nanis | 2026-09-13 19:03:55 +0000 |
| commit | 8fbe8d439b418796932aaa88297e006c714e4d13 (patch) | |
| tree | 6c800476edc1e771fc570b559d483df8d59d4324 /tests/fixtures/flow.py | |
| parent | 12f6fee851b68e86af658dfa17e4a0daed457dd1 (diff) | |
| parent | 2c94f248d2438071a918fa9a30bf114ef9aa29b4 (diff) | |
| download | amt-jb-8fbe8d439b418796932aaa88297e006c714e4d13.tar.gz amt-jb-8fbe8d439b418796932aaa88297e006c714e4d13.zip | |
Merges pull request #3
Off of Amazon!!!
Diffstat (limited to 'tests/fixtures/flow.py')
| -rw-r--r-- | tests/fixtures/flow.py | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/tests/fixtures/flow.py b/tests/fixtures/flow.py index dd2f83e..7bf8b4f 100644 --- a/tests/fixtures/flow.py +++ b/tests/fixtures/flow.py @@ -1,18 +1,21 @@ -from datetime import timezone, datetime -from typing import Dict, Callable, Any, Optional +from collections.abc import Callable +from datetime import datetime, timezone +from typing import Any from uuid import uuid4 import pytest import requests -from generalresearchutils.models.thl.payout import UserPayoutEvent -from generalresearchutils.models.thl.wallet import PayoutType -from generalresearchutils.models.thl.wallet.cashout_method import ( - CashoutRequestResponse, +from generalresearch.currency import USDCent +from generalresearch.models.thl.definitions import PayoutStatus +from generalresearch.models.thl.payout import UserPayoutEvent +from generalresearch.models.thl.wallet.cashout_method import ( CashoutRequestInfo, + CashoutRequestResponse, ) +from generalresearch.models.thl.wallet.definitions import PayoutType from mypy_boto3_mturk.type_defs import ( - GetHITResponseTypeDef, GetAssignmentResponseTypeDef, + GetHITResponseTypeDef, ) from jb.config import settings @@ -20,8 +23,6 @@ from jb.managers.amt import ( APPROVAL_MESSAGE, BONUS_MESSAGE, ) -from generalresearchutils.currency import USDCent -from generalresearchutils.models.thl.definitions import PayoutStatus @pytest.fixture @@ -31,16 +32,16 @@ def approved_assignment_stubs( amt_assignment_id: str, amt_hit_id: str, hit_response_reviewing: GetHITResponseTypeDef, -) -> Callable[..., list[Dict[str, Any]]]: +) -> Callable[..., list[dict[str, Any]]]: # These are the AMT_CLIENT stubs/mocks that need to be set when running # process_assignment_submitted() which will result in an approved # assignment and sent bonus def _inner( feedback: str = APPROVAL_MESSAGE, - override_response: Optional[str] = None, - override_approve_response: Optional[str] = None, - ) -> list[Dict[str, Any]]: + override_response: str | None = None, + override_approve_response: str | None = None, + ) -> list[dict[str, Any]]: response = override_response or assignment_response approve_response = ( @@ -84,11 +85,11 @@ def approved_assignment_stubs( @pytest.fixture def approved_assignment_stubs_w_bonus( - approved_assignment_stubs: Callable[..., list[Dict[str, Any]]], + approved_assignment_stubs: Callable[..., list[dict[str, Any]]], amt_worker_id: str, amt_assignment_id: str, pe_id: str, -) -> list[Dict[str, Any]]: +) -> list[dict[str, Any]]: now = datetime.now(tz=timezone.utc) stubs = approved_assignment_stubs().copy() @@ -132,16 +133,16 @@ def rejected_assignment_stubs( amt_assignment_id: str, amt_hit_id: str, hit_response_reviewing: GetHITResponseTypeDef, -) -> Callable[..., list[Dict[str, Any]]]: +) -> Callable[..., list[dict[str, Any]]]: # These are the AMT_CLIENT stubs/mocks that need to be set when running # process_assignment_submitted() which will result in a rejected # assignment def _inner( reject_reason: str, - override_response: Optional[str] = None, - override_reject_response: Optional[str] = None, - ) -> list[Dict[str, Any]]: + override_response: str | None = None, + override_reject_response: str | None = None, + ) -> list[dict[str, Any]]: response = override_response or assignment_response reject_response = ( @@ -233,7 +234,7 @@ def mock_thl_responses( elif url == wallet_url: class MockThlWalletResponse: - def json(self) -> Dict[str, Any]: + def json(self) -> dict[str, Any]: return { "wallet": { "amount": wallet_redeemable_amount, @@ -246,7 +247,7 @@ def mock_thl_responses( elif url == status_url: class MockThlStatusResponse: - def json(self) -> Dict[str, Any]: + def json(self) -> dict[str, Any]: return { "tsid": tsid, "product_id": str(settings.product_id), |
