Skip to content

Commit

Permalink
Fix wallet action scope test mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Quexington committed Jan 14, 2025
1 parent 6ef1727 commit 180293b
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions chia/_tests/wallet/test_wallet_action_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from chia_rs import G2Element

from chia._tests.cmds.wallet.test_consts import STD_TX
from chia.data_layer.singleton_record import SingletonRecord
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint64
Expand Down Expand Up @@ -36,7 +37,15 @@ def test_back_and_forth_serialization() -> None:
@dataclass
class MockWalletStateManager:
most_recent_call: Optional[
tuple[list[TransactionRecord], bool, bool, bool, list[SigningResponse], list[WalletSpendBundle]]
tuple[
list[TransactionRecord],
bool,
bool,
bool,
list[SigningResponse],
list[WalletSpendBundle],
list[SingletonRecord],
],
] = None

async def add_pending_transactions(
Expand All @@ -47,8 +56,17 @@ async def add_pending_transactions(
sign: bool,
additional_signing_responses: list[SigningResponse],
extra_spends: list[WalletSpendBundle],
singleton_records: list[SingletonRecord],
) -> list[TransactionRecord]:
self.most_recent_call = (txs, push, merge_spends, sign, additional_signing_responses, extra_spends)
self.most_recent_call = (
txs,
push,
merge_spends,
sign,
additional_signing_responses,
extra_spends,
singleton_records,
)
return txs


Expand All @@ -73,7 +91,7 @@ async def test_wallet_action_scope() -> None:
action_scope.side_effects

assert action_scope.side_effects.transactions == [STD_TX]
assert wsm.most_recent_call == ([STD_TX], True, False, True, [], [])
assert wsm.most_recent_call == ([STD_TX], True, False, True, [], [], [])

async with wsm.new_action_scope( # type: ignore[attr-defined]
DEFAULT_TX_CONFIG, push=False, merge_spends=True, sign=True, additional_signing_responses=[], extra_spends=[]
Expand All @@ -82,4 +100,4 @@ async def test_wallet_action_scope() -> None:
interface.side_effects.transactions = []

assert action_scope.side_effects.transactions == []
assert wsm.most_recent_call == ([], False, True, True, [], [])
assert wsm.most_recent_call == ([], False, True, True, [], [], [])

0 comments on commit 180293b

Please sign in to comment.