@@ -96,20 +96,20 @@ def create_token_without_pause_key(client, operator_id, operator_key):
9696
9797def attempt_pause_should_fail (client , token_id , operator_key ):
9898 print ("🔹 Attempting to pause token WITHOUT a pause key... (expected failure)" )
99- try :
100- tx = (
101- TokenPauseTransaction ()
102- .set_token_id (token_id )
103- .freeze_with (client )
104- .sign (operator_key )
105- )
106- receipt = tx .execute (client )
10799
108- print ("⚠️ Unexpected success! Pause should NOT be possible." )
109- print (f"Status: { ResponseCode (receipt .status ).name } \n " )
100+ tx = (
101+ TokenPauseTransaction ()
102+ .set_token_id (token_id )
103+ .freeze_with (client )
104+ .sign (operator_key )
105+ )
110106
111- except Exception as e :
112- print (f"✅ Expected failure occurred: { e } \n " )
107+ receipt = tx .execute (client )
108+
109+ if receipt .status == ResponseCode .TOKEN_HAS_NO_PAUSE_KEY :
110+ print ("✅ Expected failure: token cannot be paused because no pause key exists.\n " )
111+ else :
112+ print (f"❌ Unexpected status: { ResponseCode (receipt .status ).name } \n " )
113113
114114
115115# -------------------------------------------------------
@@ -200,8 +200,14 @@ def create_temp_account(client, operator_key):
200200 )
201201
202202 receipt = tx .execute (client )
203+
204+ if receipt .status != ResponseCode .SUCCESS :
205+ print (f"❌ Failed to create temp account: { ResponseCode (receipt .status ).name } " )
206+ sys .exit (1 )
207+
203208 account_id = receipt .account_id
204209 print (f"✅ Temp account created: { account_id } \n " )
210+
205211 return account_id , new_key
206212
207213
0 commit comments