@@ -142,6 +142,64 @@ def test_set_methods_require_not_frozen(mock_account_ids, nft_id, mock_client):
142142 reject_tx .set_nft_ids (nft_ids )
143143
144144
145+ def test_add_token_id (mock_account_ids ):
146+ """Test appending fungible token IDs one at a time."""
147+ _ , _ , _ , token_id_1 , token_id_2 = mock_account_ids
148+
149+ reject_tx = TokenRejectTransaction ()
150+
151+ # First append starts from the default empty list and returns self for chaining
152+ tx_after_add = reject_tx .add_token_id (token_id_1 )
153+ assert tx_after_add is reject_tx
154+ assert reject_tx .token_ids == [token_id_1 ]
155+
156+ # Second append preserves the existing entry and keeps insertion order
157+ reject_tx .add_token_id (token_id_2 )
158+ assert reject_tx .token_ids == [token_id_1 , token_id_2 ]
159+
160+
161+ def test_add_token_id_appends_to_preset_list (mock_account_ids ):
162+ """Test that add_token_id appends onto a list provided via the constructor/setter."""
163+ _ , _ , _ , token_id_1 , token_id_2 = mock_account_ids
164+
165+ reject_tx = TokenRejectTransaction (token_ids = [token_id_1 ])
166+ reject_tx .add_token_id (token_id_2 )
167+
168+ assert reject_tx .token_ids == [token_id_1 , token_id_2 ]
169+
170+
171+ def test_add_nft_id (mock_account_ids ):
172+ """Test appending NFT IDs one at a time."""
173+ _ , _ , _ , token_id , _ = mock_account_ids
174+ nft_id_1 = NftId (token_id = token_id , serial_number = 1 )
175+ nft_id_2 = NftId (token_id = token_id , serial_number = 2 )
176+
177+ reject_tx = TokenRejectTransaction ()
178+
179+ # First append starts from the default empty list and returns self for chaining
180+ tx_after_add = reject_tx .add_nft_id (nft_id_1 )
181+ assert tx_after_add is reject_tx
182+ assert reject_tx .nft_ids == [nft_id_1 ]
183+
184+ # Second append preserves the existing entry and keeps insertion order
185+ reject_tx .add_nft_id (nft_id_2 )
186+ assert reject_tx .nft_ids == [nft_id_1 , nft_id_2 ]
187+
188+
189+ def test_add_methods_require_not_frozen (mock_account_ids , nft_id , mock_client ):
190+ """Test that add_token_id and add_nft_id are rejected once the transaction is frozen."""
191+ _ , _ , _ , token_id , _ = mock_account_ids
192+
193+ reject_tx = TokenRejectTransaction ()
194+ reject_tx .freeze_with (mock_client )
195+
196+ with pytest .raises (Exception , match = "Transaction is immutable; it has been frozen" ):
197+ reject_tx .add_token_id (token_id )
198+
199+ with pytest .raises (Exception , match = "Transaction is immutable; it has been frozen" ):
200+ reject_tx .add_nft_id (nft_id )
201+
202+
145203def test_reject_transaction_can_execute (mock_account_ids ):
146204 """Test that a reject transaction can be executed successfully."""
147205 account_id , owner_account_id , _ , token_id , _ = mock_account_ids
0 commit comments