Skip to content

Commit

Permalink
Clarify checking compute_memos results in NFT wallet tests (Chia-Netw…
Browse files Browse the repository at this point in the history
…ork#17137)

Clarify checking compute_memos results in NFT wallet tests.
  • Loading branch information
AmineKhaldi authored Dec 22, 2023
1 parent c1dd6c6 commit 04f0a74
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/wallet/nft_wallet/test_nft_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def test_nft_wallet_creation_and_transfer(self_hostname: str, two_wallet_n
sb = await nft_wallet_0.generate_new_nft(metadata, DEFAULT_TX_CONFIG)
assert sb is not None
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())

for i in range(1, num_blocks):
Expand Down Expand Up @@ -271,7 +271,7 @@ async def test_nft_wallet_creation_and_transfer(self_hostname: str, two_wallet_n
sb = await nft_wallet_0.generate_new_nft(metadata, DEFAULT_TX_CONFIG)
assert sb is not None
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(10, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())

await time_out_assert(30, wallet_node_0.wallet_state_manager.lock.locked, False)
Expand All @@ -294,7 +294,7 @@ async def test_nft_wallet_creation_and_transfer(self_hostname: str, two_wallet_n
await time_out_assert_not_none(
30, full_node_api.full_node.mempool_manager.get_spendbundle, txs[0].spend_bundle.name()
)
assert compute_memos(txs[0].spend_bundle)
assert len(compute_memos(txs[0].spend_bundle)) > 0

for i in range(1, num_blocks * 2):
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph1))
Expand All @@ -316,7 +316,7 @@ async def test_nft_wallet_creation_and_transfer(self_hostname: str, two_wallet_n
await time_out_assert_not_none(
30, full_node_api.full_node.mempool_manager.get_spendbundle, txs[0].spend_bundle.name()
)
assert compute_memos(txs[0].spend_bundle)
assert len(compute_memos(txs[0].spend_bundle)) > 0

for i in range(1, num_blocks):
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph1))
Expand Down Expand Up @@ -719,7 +719,7 @@ async def test_nft_with_did_wallet_creation(self_hostname: str, two_wallet_nodes
sb = resp["spend_bundle"]
# ensure hints are generated correctly
memos = compute_memos(sb)
assert memos
assert len(memos) > 0
puzhashes = []
for x in memos.values():
puzhashes.extend(list(x))
Expand Down Expand Up @@ -749,7 +749,7 @@ async def test_nft_with_did_wallet_creation(self_hostname: str, two_wallet_nodes
sb = resp["spend_bundle"]

# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())

await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
Expand Down Expand Up @@ -879,7 +879,7 @@ async def test_nft_rpc_mint(self_hostname: str, two_wallet_nodes: Any, trusted:
sb = resp["spend_bundle"]

# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())

for i in range(1, num_blocks):
Expand Down Expand Up @@ -1020,7 +1020,7 @@ async def test_nft_transfer_nft_with_did(self_hostname: str, two_wallet_nodes: A
)
assert resp.get("success")
sb = resp["spend_bundle"]
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())
await make_new_block_with(resp, full_node_api, ph1)
await time_out_assert(30, wallet_0.get_unconfirmed_balance, 5999999999798)
Expand Down Expand Up @@ -1148,7 +1148,7 @@ async def test_update_metadata_for_nft_did(self_hostname: str, two_wallet_nodes:
sb = resp["spend_bundle"]

# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())

for i in range(1, num_blocks):
Expand Down Expand Up @@ -1281,7 +1281,7 @@ async def test_nft_bulk_set_did(self_hostname: str, two_wallet_nodes: Any, trust
)
sb = await make_new_block_with(resp, full_node_api, ph, wallet_node_0)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await wait_rpc_state_condition(
30, api_0.nft_get_nfts, [{"wallet_id": nft_wallet_0_id}], lambda x: len(x["nft_list"]) > 0
)
Expand All @@ -1300,7 +1300,7 @@ async def test_nft_bulk_set_did(self_hostname: str, two_wallet_nodes: Any, trust
30, api_0.nft_get_nfts, [{"wallet_id": nft_wallet_0_id}], lambda x: len(x["nft_list"]) > 0
)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
resp = await api_0.nft_mint_nft(
{
"wallet_id": nft_wallet_1_id,
Expand All @@ -1312,7 +1312,7 @@ async def test_nft_bulk_set_did(self_hostname: str, two_wallet_nodes: Any, trust
)
sb = await make_new_block_with(resp, full_node_api, ph, wallet_node_0)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0

# Check DID NFT
coins_response = await wait_rpc_state_condition(
Expand Down Expand Up @@ -1447,7 +1447,7 @@ async def test_nft_bulk_transfer(two_wallet_nodes: Any, trusted: Any) -> None:
)
sb = await make_new_block_with(resp, full_node_api, ph)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await wait_rpc_state_condition(
30, api_0.nft_get_nfts, [{"wallet_id": nft_wallet_0_id}], lambda x: len(x["nft_list"]) > 0
)
Expand Down Expand Up @@ -1476,7 +1476,7 @@ async def test_nft_bulk_transfer(two_wallet_nodes: Any, trusted: Any) -> None:
)
sb = await make_new_block_with(resp, full_node_api, ph)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0

# Check DID NFT
coins_response = await wait_rpc_state_condition(
Expand Down Expand Up @@ -1507,7 +1507,7 @@ async def test_nft_bulk_transfer(two_wallet_nodes: Any, trusted: Any) -> None:
assert resp["tx_num"] == 4
sb = await make_new_block_with(resp, full_node_api, ph)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert(30, get_wallet_number, 2, wallet_node_1.wallet_state_manager)
coins_response = await wait_rpc_state_condition(
30, api_1.nft_get_nfts, [{"wallet_id": 2}], lambda x: len(x["nft_list"]) == 3
Expand Down Expand Up @@ -1593,7 +1593,7 @@ async def test_nft_set_did(self_hostname: str, two_wallet_nodes: Any, trusted: A
)
sb = await make_new_block_with(resp, full_node_api, ph)
# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0

# Check DID NFT
coins_response = await wait_rpc_state_condition(
Expand Down Expand Up @@ -1747,7 +1747,7 @@ async def test_set_nft_status(self_hostname: str, two_wallet_nodes: Any, trusted
sb = resp["spend_bundle"]

# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())
await make_new_block_with(resp, full_node_api, ph)

Expand Down Expand Up @@ -1833,7 +1833,7 @@ async def test_nft_sign_message(self_hostname: str, two_wallet_nodes: Any, trust
sb = resp["spend_bundle"]

# ensure hints are generated
assert compute_memos(sb)
assert len(compute_memos(sb)) > 0
await time_out_assert_not_none(30, full_node_api.full_node.mempool_manager.get_spendbundle, sb.name())
await make_new_block_with(resp, full_node_api, ph)

Expand Down

0 comments on commit 04f0a74

Please sign in to comment.