Skip to content

Commit 6d9d60e

Browse files
committed
verify: receipt status
1 parent 835c369 commit 6d9d60e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/integration/token_pause_transaction_e2e_test.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,16 @@ def test_pause_nonexistent_token_id_raises_precheck_error(env):
7575
fake = TokenId(0, 0, 99999999)
7676
tx = TokenPauseTransaction().set_token_id(fake)
7777

78-
with pytest.raises(ReceiptStatusError, match=ResponseCode.get_name(ResponseCode.INVALID_TOKEN_ID)):
79-
# .execute() will auto‐freeze and auto‐sign with the operator key
80-
tx.execute(env.client) # ← this is what runs the precheck
78+
# with pytest.raises(ReceiptStatusError, match=ResponseCode.get_name(ResponseCode.INVALID_TOKEN_ID)):
79+
# # .execute() will auto‐freeze and auto‐sign with the operator key
80+
# tx.execute(env.client) # ← this is what runs the precheck
8181

82+
receipt = tx.execute(env.client)
8283

84+
assert receipt.status == ResponseCode.INVALID_TOKEN_ID, (
85+
f"Expected INVALID_TOKEN_ID but got "
86+
f"{ResponseCode.get_name(receipt.status)}"
87+
)
8388

8489
@mark.integration
8590
def test_pause_fails_for_unpausable_token(env, unpausable_token):
@@ -89,7 +94,7 @@ def test_pause_fails_for_unpausable_token(env, unpausable_token):
8994
"""
9095
tx = TokenPauseTransaction().set_token_id(unpausable_token)
9196

92-
with pytest.raises(PrecheckError, match=ResponseCode.get_name(ResponseCode.TOKEN_HAS_NO_PAUSE_KEY),):
97+
with pytest.raises(ReceiptStatusError, match=ResponseCode.get_name(ResponseCode.TOKEN_HAS_NO_PAUSE_KEY),):
9398
# .execute() will auto‐freeze and auto‐sign with the operator key
9499
tx.execute(env.client) # ← this is what runs the precheck
95100

@@ -103,7 +108,7 @@ def test_pause_requires_pause_key_signature(env, pausable_token):
103108
tx = TokenPauseTransaction().set_token_id(pausable_token)
104109
tx = tx.freeze_with(env.client)
105110

106-
with pytest.raises(PrecheckError, match=ResponseCode.get_name(ResponseCode.TOKEN_HAS_NO_PAUSE_KEY),):
111+
with pytest.raises(ReceiptStatusError, match=ResponseCode.get_name(ResponseCode.TOKEN_HAS_NO_PAUSE_KEY),):
107112
tx.execute(env.client) # ← this is what runs the precheck
108113

109114
@mark.integration
@@ -113,7 +118,7 @@ def test_pause_with_invalid_key_fails_precheck(env, pausable_token):
113118
signing with some other key causes an INVALID_PAUSE_KEY precheck failure.
114119
"""
115120
bad_key = PrivateKey.generate()
116-
with pytest.raises(PrecheckError,match=ResponseCode.get_name(ResponseCode.INVALID_PAUSE_KEY)):
121+
with pytest.raises(ReceiptStatusError,match=ResponseCode.get_name(ResponseCode.INVALID_PAUSE_KEY)):
117122
# freeze, sign with wrong key, then execute
118123
tx = TokenPauseTransaction().set_token_id(pausable_token)
119124
tx = tx.freeze_with(env.client)

0 commit comments

Comments
 (0)