Skip to content

Commit

Permalink
CHIA-1451 Remove no longer needed TestWalletInterestedStore class (#1…
Browse files Browse the repository at this point in the history
…8621)

Remove no longer needed TestWalletInterestedStore.
  • Loading branch information
AmineKhaldi authored Sep 24, 2024
1 parent 06ae868 commit 75d6126
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions chia/_tests/wallet/test_wallet_interested_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,33 @@
from chia.wallet.wallet_interested_store import WalletInterestedStore


class TestWalletInterestedStore:
@pytest.mark.anyio
async def test_store(self, seeded_random: random.Random):
async with DBConnection(1) as db_wrapper:
store = await WalletInterestedStore.create(db_wrapper)
coin_1 = Coin(bytes32.random(seeded_random), bytes32.random(seeded_random), uint64(12312))
coin_2 = Coin(bytes32.random(seeded_random), bytes32.random(seeded_random), uint64(12312))
assert (await store.get_interested_coin_ids()) == []
await store.add_interested_coin_id(coin_1.name())
assert (await store.get_interested_coin_ids()) == [coin_1.name()]
await store.add_interested_coin_id(coin_1.name())
assert (await store.get_interested_coin_ids()) == [coin_1.name()]
await store.add_interested_coin_id(coin_2.name())
assert set(await store.get_interested_coin_ids()) == {coin_1.name(), coin_2.name()}
await store.remove_interested_coin_id(coin_1.name())
assert set(await store.get_interested_coin_ids()) == {coin_2.name()}
puzzle_hash = bytes32.random(seeded_random)
assert len(await store.get_interested_puzzle_hashes()) == 0
@pytest.mark.anyio
async def test_store(seeded_random: random.Random):
async with DBConnection(1) as db_wrapper:
store = await WalletInterestedStore.create(db_wrapper)
coin_1 = Coin(bytes32.random(seeded_random), bytes32.random(seeded_random), uint64(12312))
coin_2 = Coin(bytes32.random(seeded_random), bytes32.random(seeded_random), uint64(12312))
assert (await store.get_interested_coin_ids()) == []
await store.add_interested_coin_id(coin_1.name())
assert (await store.get_interested_coin_ids()) == [coin_1.name()]
await store.add_interested_coin_id(coin_1.name())
assert (await store.get_interested_coin_ids()) == [coin_1.name()]
await store.add_interested_coin_id(coin_2.name())
assert set(await store.get_interested_coin_ids()) == {coin_1.name(), coin_2.name()}
await store.remove_interested_coin_id(coin_1.name())
assert set(await store.get_interested_coin_ids()) == {coin_2.name()}
puzzle_hash = bytes32.random(seeded_random)
assert len(await store.get_interested_puzzle_hashes()) == 0

await store.add_interested_puzzle_hash(puzzle_hash, 2)
assert len(await store.get_interested_puzzle_hashes()) == 1
await store.add_interested_puzzle_hash(puzzle_hash, 2)
assert len(await store.get_interested_puzzle_hashes()) == 1
assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) == 2
await store.add_interested_puzzle_hash(puzzle_hash, 3)
assert len(await store.get_interested_puzzle_hashes()) == 1
await store.add_interested_puzzle_hash(puzzle_hash, 2)
assert len(await store.get_interested_puzzle_hashes()) == 1
await store.add_interested_puzzle_hash(puzzle_hash, 2)
assert len(await store.get_interested_puzzle_hashes()) == 1
assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) == 2
await store.add_interested_puzzle_hash(puzzle_hash, 3)
assert len(await store.get_interested_puzzle_hashes()) == 1

assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) == 3
await store.remove_interested_puzzle_hash(puzzle_hash)
assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) is None
assert len(await store.get_interested_puzzle_hashes()) == 0
assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) == 3
await store.remove_interested_puzzle_hash(puzzle_hash)
assert (await store.get_interested_puzzle_hash_wallet_id(puzzle_hash)) is None
assert len(await store.get_interested_puzzle_hashes()) == 0

0 comments on commit 75d6126

Please sign in to comment.