@@ -237,10 +237,10 @@ def test_token_creation_validation(
237237
238238########### Tests for Signing and Protobuf Conversion ###########
239239
240- # This test uses fixture mock_account_ids as parameter
241- def test_sign_transaction (mock_account_ids ):
240+ # This test uses fixture ( mock_account_ids, mock_client) as parameter
241+ def test_sign_transaction (mock_account_ids , mock_client ):
242242 """Test signing the token creation transaction that has multiple keys."""
243- treasury_account , _ , node_account_id , _ , _ = mock_account_ids
243+ treasury_account , _ , _ , _ , _ = mock_account_ids
244244
245245 # Mock keys
246246 private_key = MagicMock ()
@@ -270,7 +270,8 @@ def test_sign_transaction(mock_account_ids):
270270 token_tx .set_freeze_key (private_key_freeze )
271271
272272 token_tx .transaction_id = generate_transaction_id (treasury_account )
273- token_tx .node_account_id = node_account_id
273+
274+ token_tx .freeze_with (mock_client )
274275
275276 # Sign with both sign keys
276277 token_tx .sign (private_key ) # Necessary
@@ -291,10 +292,10 @@ def test_sign_transaction(mock_account_ids):
291292 for sig_pair in token_tx .signature_map .sigPair :
292293 assert sig_pair .pubKeyPrefix not in (b"supply_public_key" , b"freeze_public_key" )
293294
294- # This test uses fixture mock_account_ids as parameter
295- def test_to_proto_without_keys (mock_account_ids ):
295+ # This test uses fixture ( mock_account_ids, mock_client) as parameter
296+ def test_to_proto_without_keys (mock_account_ids , mock_client ):
296297 """Test protobuf conversion when keys are not set."""
297- treasury_account , _ , node_account_id , _ , _ = mock_account_ids
298+ treasury_account , _ , _ , _ , _ = mock_account_ids
298299
299300 token_tx = TokenCreateTransaction ()
300301 token_tx .set_token_name ("MyToken" )
@@ -303,13 +304,14 @@ def test_to_proto_without_keys(mock_account_ids):
303304 token_tx .set_initial_supply (1000 )
304305 token_tx .set_treasury_account_id (treasury_account )
305306 token_tx .transaction_id = generate_transaction_id (treasury_account )
306- token_tx .node_account_id = node_account_id
307307
308308 # Mock treasury/operator key
309309 private_key = MagicMock ()
310310 private_key .sign .return_value = b"signature"
311311 private_key .public_key ().to_bytes_raw .return_value = b"public_key"
312312
313+ token_tx .freeze_with (mock_client )
314+
313315 # Sign with treasury key
314316 token_tx .sign (private_key )
315317
@@ -335,10 +337,10 @@ def test_to_proto_without_keys(mock_account_ids):
335337
336338 assert not transaction_body .tokenCreation .HasField ("adminKey" )
337339
338- # This test uses fixture mock_account_ids as parameter
339- def test_to_proto_with_keys (mock_account_ids ):
340+ # This test uses fixture ( mock_account_ids, mock_client) as parameter
341+ def test_to_proto_with_keys (mock_account_ids , mock_client ):
340342 """Test converting the token creation transaction to protobuf format after signing."""
341- treasury_account , _ , node_account_id , _ , _ = mock_account_ids
343+ treasury_account , _ , _ , _ , _ = mock_account_ids
342344
343345 # Mock keys
344346 private_key = MagicMock ()
@@ -369,10 +371,11 @@ def test_to_proto_with_keys(mock_account_ids):
369371 token_tx .set_freeze_key (private_key_freeze )
370372
371373 token_tx .transaction_id = generate_transaction_id (treasury_account )
372- token_tx .node_account_id = node_account_id
374+
375+ token_tx .freeze_with (mock_client )
373376
374377 # Sign with required sign keys
375- token_tx .sign (private_key )
378+ token_tx .sign (private_key )
376379 token_tx .sign (private_key_admin )
377380
378381 # Convert to protobuf
@@ -472,13 +475,13 @@ def test_transaction_execution_failure(mock_account_ids):
472475 # Verify _execute was called with client
473476 mock_execute .assert_called_once_with (token_tx .client )
474477
475- # This test uses fixture mock_account_ids as parameter
476- def test_overwrite_defaults (mock_account_ids ):
478+ # This test uses fixture ( mock_account_ids, mock_client) as parameter
479+ def test_overwrite_defaults (mock_account_ids , mock_client ):
477480 """
478481 Demonstrates that defaults in TokenCreateTransaction can be overwritten
479482 by calling set_* methods, and the final protobuf reflects the updated values.
480483 """
481- treasury_account , _ , node_account_id , _ , _ = mock_account_ids
484+ treasury_account , _ , _ , _ , _ = mock_account_ids
482485
483486 # Create a new TokenCreateTransaction with all default params
484487 token_tx = TokenCreateTransaction ()
@@ -500,7 +503,8 @@ def test_overwrite_defaults(mock_account_ids):
500503
501504 # Set transaction/node IDs so can sign
502505 token_tx .transaction_id = generate_transaction_id (treasury_account )
503- token_tx .node_account_id = node_account_id
506+
507+ token_tx .freeze_with (mock_client )
504508
505509 # Mock a private key and sign the transaction
506510 private_key = MagicMock ()
@@ -621,13 +625,13 @@ def test_build_transaction_body_non_fungible(mock_account_ids):
621625 assert not transaction_body .tokenCreation .HasField ("supplyKey" )
622626 assert not transaction_body .tokenCreation .HasField ("freezeKey" )
623627
624- # This test uses fixture mock_account_ids as parameter
625- def test_build_and_sign_nft_transaction_to_proto (mock_account_ids ):
628+ # This test uses fixture ( mock_account_ids, mock_client) as parameter
629+ def test_build_and_sign_nft_transaction_to_proto (mock_account_ids , mock_client ):
626630 """
627631 Test building, signing, and protobuf serialization of
628632 a valid Non-Fungible Unique token creation transaction.
629633 """
630- treasury_account , _ , node_account_id , _ , _ = mock_account_ids
634+ treasury_account , _ , _ , _ , _ = mock_account_ids
631635
632636 # Mock keys
633637 private_key_private = MagicMock ()
@@ -659,7 +663,8 @@ def test_build_and_sign_nft_transaction_to_proto(mock_account_ids):
659663 token_tx .set_freeze_key (private_key_freeze )
660664
661665 token_tx .transaction_id = generate_transaction_id (treasury_account )
662- token_tx .node_account_id = node_account_id
666+
667+ token_tx .freeze_with (mock_client )
663668
664669 # Sign the transaction
665670 token_tx .sign (private_key_private )
0 commit comments