@@ -47,7 +47,7 @@ def test_pause_missing_token_id_raises_value_error(env):
4747 tx = TokenPauseTransaction ()
4848
4949 with pytest .raises (ValueError , match = "token_id must be set" ):
50- tx .freeze_with (env .client )
50+ tx .freeze_with (env .client ) # ← builds the body which fails
5151
5252@mark .integration
5353def test_pause_nonexistent_token_id_raises_precheck_error (env ):
@@ -60,7 +60,7 @@ def test_pause_nonexistent_token_id_raises_precheck_error(env):
6060
6161 with pytest .raises (PrecheckError , match = ResponseCode .get_name (ResponseCode .INVALID_TOKEN_ID )):
6262 # .execute() will auto‐freeze and auto‐sign with the operator key
63- tx .execute (env .client )
63+ tx .execute (env .client ) # ← this is what runs the precheck
6464
6565@mark .integration
6666def test_pause_fails_for_unpausable_token (env , unpausable_token ):
@@ -72,7 +72,7 @@ def test_pause_fails_for_unpausable_token(env, unpausable_token):
7272
7373 with pytest .raises (PrecheckError , match = ResponseCode .get_name (ResponseCode .TOKEN_HAS_NO_PAUSE_KEY ),):
7474 # .execute() will auto‐freeze and auto‐sign with the operator key
75- tx .execute (env .client )
75+ tx .execute (env .client ) # ← this is what runs the precheck
7676
7777@mark .integration
7878def test_pause_requires_pause_key_signature (env , pausable_token ):
@@ -85,7 +85,7 @@ def test_pause_requires_pause_key_signature(env, pausable_token):
8585 tx = tx .freeze_with (env .client )
8686
8787 with pytest .raises (PrecheckError , match = ResponseCode .get_name (ResponseCode .TOKEN_HAS_NO_PAUSE_KEY ),):
88- tx .execute (env .client )
88+ tx .execute (env .client ) # ← this is what runs the precheck
8989
9090@mark .integration
9191def test_pause_with_invalid_key_fails_precheck (env , pausable_token ):
@@ -98,20 +98,37 @@ def test_pause_with_invalid_key_fails_precheck(env, pausable_token):
9898 # freeze, sign with wrong key, then execute
9999 tx = TokenPauseTransaction ().set_token_id (pausable_token )
100100 tx = tx .freeze_with (env .client )
101- tx = tx .sign (bad_key )
102- tx .execute (env .client )
101+ tx = tx .sign (bad_key ) # ← signed with wrong key
102+ tx .execute (env .client ) # ← this is what runs the precheck
103103
104104@mark .integration
105105def test_pause_already_paused_token_fails (env , pausable_token ):
106106 """
107- Attempting to pause a token that is already paused should fail
107+ Attempting to pause a token that is already paused should fail
108108 in the handle phase with TOKEN_IS_PAUSED.
109109 """
110- env .pause_token (pausable_token )
111-
112- # 2) Second pause (signed with the same pause key by default)
113- with pytest .raises (ReceiptStatusError ,match = ResponseCode .get_name (ResponseCode .TOKEN_IS_PAUSED )):
114- env .pause_token (pausable_token )
110+ # 1) First pause: build, freeze, sign with the real pause key, execute
111+ tx1 = (
112+ TokenPauseTransaction ()
113+ .set_token_id (pausable_token )
114+ .freeze_with (env .client )
115+ .sign (env .operator_key )
116+ )
117+ receipt1 = tx1 .execute (env .client )
118+ assert receipt1 .status == ResponseCode .SUCCESS
119+
120+ # 2) Second pause: do the exact same, but now expect TOKEN_IS_PAUSED
121+ tx2 = (
122+ TokenPauseTransaction ()
123+ .set_token_id (pausable_token )
124+ .freeze_with (env .client )
125+ .sign (env .operator_key )
126+ )
127+ with pytest .raises (
128+ ReceiptStatusError ,
129+ match = ResponseCode .get_name (ResponseCode .TOKEN_IS_PAUSED )
130+ ):
131+ tx2 .execute (env .client )
115132
116133@mark .integration
117134class TestTokenPause :
@@ -129,18 +146,28 @@ def test_transfer_before_pause(self, env, account: Account, pausable_token):
129146
130147 def test_pause_sets_token_status_to_paused (self , env , pausable_token ):
131148 """
132- Take a pausable token, that is not paused, it should be UNPAUSED.
133- A token pause transaction to an unpaused token now makes it PAUSED.
149+ Take a pausable token (UNPAUSED), submit a pause transaction signed
150+ with its pause key, then verify it ends up PAUSED.
134151 """
135- # pre-pause sanity check
152+ # 1) pre-pause sanity check
136153 info = TokenInfoQuery ().set_token_id (pausable_token ).execute (env .client )
154+
137155 assert info .token_status .name == "UNPAUSED"
138156
139- # pause via fixture
140- env .pause_token (pausable_token , key = env .operator_key )
157+ # 2) build, freeze, sign & execute the pause tx
158+ pause_key = env .operator_key
159+ tx = (
160+ TokenPauseTransaction ()
161+ .set_token_id (pausable_token )
162+ .freeze_with (env .client )
163+ .sign (pause_key )
164+ )
165+ receipt = tx .execute (env .client )
166+ assert receipt .status == ResponseCode .SUCCESS
141167
142- # verify
168+ # 3) post-pause verify
143169 info2 = TokenInfoQuery ().set_token_id (pausable_token ).execute (env .client )
170+
144171 assert info2 .token_status .name == "PAUSED"
145172
146173 def test_transfers_blocked_when_paused (self , env , account : Account , pausable_token ):
@@ -159,7 +186,14 @@ def test_transfers_blocked_when_paused(self, env, account: Account, pausable_tok
159186
160187 # pause the token
161188 pause_key = env .operator_key
162- env .pause_token (pausable_token , key = pause_key )
189+ tx = (
190+ TokenPauseTransaction ()
191+ .set_token_id (pausable_token )
192+ .freeze_with (env .client )
193+ .sign (pause_key )
194+ )
195+ receipt = tx .execute (env .client )
196+ assert receipt .status == ResponseCode .SUCCESS
163197
164198 # attempt to transfer 1 token
165199 tx = (
0 commit comments