diff options
| author | Max Nanis | 2026-09-09 20:32:17 -0700 |
|---|---|---|
| committer | Max Nanis | 2026-09-09 20:32:17 -0700 |
| commit | 832aecaddce80e312095ecdb572d7756eb9df5e9 (patch) | |
| tree | 3f9b27bf285ef0648e22a1480ab213255d2cfee6 /tests/fixtures/flow.py | |
| parent | e7e5b5f8bf81e78e417ecdb9dd6ab1616e722fa0 (diff) | |
| download | amt-jb-832aecaddce80e312095ecdb572d7756eb9df5e9.tar.gz amt-jb-832aecaddce80e312095ecdb572d7756eb9df5e9.zip | |
Ruff auto fix, and requirements bump
Diffstat (limited to 'tests/fixtures/flow.py')
| -rw-r--r-- | tests/fixtures/flow.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/fixtures/flow.py b/tests/fixtures/flow.py index 3fcca81..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 generalresearch.currency import USDCent +from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.payout import UserPayoutEvent -from generalresearch.models.thl.wallet.definitions import PayoutType from generalresearch.models.thl.wallet.cashout_method import ( - CashoutRequestResponse, 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 generalresearch.currency import USDCent -from generalresearch.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), |
