2020
2121pytestmark = pytest .mark .unit
2222
23- # This test uses fixture mock_account_ids and generate_transaction id as parameter
24- def test_build_transaction_body (mock_account_ids , generate_transaction_id , token_id ):
23+ # This test uses fixture mock_account_ids and token_id as parameter
24+ def test_build_transaction_body (mock_account_ids , token_id ):
2525 """Test building a fungible token pause transaction body with valid values."""
2626 account_id , _ , node_account_id , _ , _ = mock_account_ids
2727
2828 pause_tx = TokenPauseTransaction ().set_token_id (token_id )
29- pause_tx .transaction_id = generate_transaction_id ( account_id )
29+ pause_tx .operator_account_id = account_id
3030 pause_tx .node_account_id = node_account_id
3131
32- transaction_body = pause_tx .build_transaction_body ()
32+ transaction_body = pause_tx .build_transaction_body () # Will generate a transaction_id
3333
3434 assert transaction_body .token_pause .token == token_id .to_proto ()
3535 assert transaction_body .transactionID == pause_tx .transaction_id .to_proto ()
3636 assert transaction_body .nodeAccountID == pause_tx .node_account_id .to_proto ()
3737
38- def test_build_transaction_body_nft (mock_account_ids , generate_transaction_id , nft_id ):
38+ def test_build_transaction_body_nft (mock_account_ids , nft_id ):
3939 """Test building an NFT‐pause transaction body with valid values."""
4040 account_id , _ , node_account_id , _ , _ = mock_account_ids
4141
4242 # nft_id is NftId(tokenId=TokenId(...), serialNumber=...)
4343 base_token_id = nft_id .tokenId
4444
4545 pause_tx = TokenPauseTransaction ().set_token_id (base_token_id )
46- pause_tx .transaction_id = generate_transaction_id ( account_id )
46+ pause_tx .operator_account_id = account_id
4747 pause_tx .node_account_id = node_account_id
4848
4949 transaction_body = pause_tx .build_transaction_body ()
@@ -52,25 +52,22 @@ def test_build_transaction_body_nft(mock_account_ids, generate_transaction_id, n
5252 assert transaction_body .transactionID == pause_tx .transaction_id .to_proto ()
5353 assert transaction_body .nodeAccountID == pause_tx .node_account_id .to_proto ()
5454
55- # This test uses fixture (mock_account_ids , mock_client) as parameter
56- def test_to_proto (mock_account_ids , mock_client , generate_transaction_id ):
55+ # This test uses fixture (token_id , mock_client) as parameter
56+ def test_to_proto (token_id , mock_client ):
5757 """Test converting the token pause transaction to protobuf format after signing."""
58- account_id , _ , _ , token_id , _ = mock_account_ids
5958
6059 # Build the TokenPauseTransaction
6160 pause_tx = (
6261 TokenPauseTransaction ()
6362 .set_token_id (token_id )
6463 )
6564
66- pause_tx .transaction_id = generate_transaction_id (account_id )
67-
6865 # Create a fake pause key that returns certain bytes when sign() is called:
6966 pause_key = MagicMock ()
7067 pause_key .sign .return_value = b'signature'
7168 pause_key .public_key ().to_bytes_raw .return_value = b'public_key'
7269
73- # Freeze and sign using the pause key:
70+ # Freeze and sign using the pause key, which also generates transaction_id :
7471 pause_tx .freeze_with (mock_client )
7572 pause_tx .sign (pause_key )
7673
0 commit comments