11from __future__ import annotations
22
33import pytest
4- from pytest import fixture
54
65from hiero_sdk_python .crypto .private_key import PrivateKey
6+ from hiero_sdk_python .exceptions import PrecheckError
77from hiero_sdk_python .query .token_info_query import TokenInfoQuery
88from hiero_sdk_python .response_code import ResponseCode
99from hiero_sdk_python .tokens .token_id import TokenId
1515pause_key = PrivateKey .generate ()
1616
1717
18- @fixture
18+ @pytest . fixture
1919def pausable_token (env ):
20- """ " Fixture to create a token that supports pausing."""
20+ """Fixture to create a token that supports pausing."""
2121 return create_fungible_token (env , opts = [lambda tx : tx .set_pause_key (pause_key )])
2222
2323
2424def pause_token (env , token_id : TokenId ):
2525 """Helper function to pause the token with the given token_id."""
26- token_pasue_tx = TokenPauseTransaction ().set_token_id (token_id ).freeze_with (env .client ).sign (pause_key )
26+ token_pause_tx = TokenPauseTransaction ().set_token_id (token_id ).freeze_with (env .client ).sign (pause_key )
2727
28- return token_pasue_tx .execute (env .client )
28+ return token_pause_tx .execute (env .client )
2929
3030
3131def get_pause_status (env , token_id : TokenId ):
@@ -34,6 +34,7 @@ def get_pause_status(env, token_id: TokenId):
3434 return token_info .pause_status .name
3535
3636
37+ @pytest .mark .integration
3738def test_unpause_token (env , pausable_token ):
3839 """Test successful unpause of a paused token."""
3940 pause_receipt = pause_token (env , pausable_token )
@@ -48,6 +49,7 @@ def test_unpause_token(env, pausable_token):
4849 assert get_pause_status (env , pausable_token ) == "UNPAUSED"
4950
5051
52+ @pytest .mark .integration
5153def test_unpause_token_without_pause_key_signature (env , pausable_token ):
5254 """Test unpause transaction without pause key signature."""
5355 pause_receipt = pause_token (env , pausable_token )
@@ -61,7 +63,8 @@ def test_unpause_token_without_pause_key_signature(env, pausable_token):
6163 assert unpause_receipt .status == ResponseCode .INVALID_SIGNATURE
6264
6365
64- def test_unpause_token_with_invalid_pasue_key (env , pausable_token ):
66+ @pytest .mark .integration
67+ def test_unpause_token_with_invalid_pause_key (env , pausable_token ):
6568 """Test unpause transaction with invalid pause key."""
6669 pause_receipt = pause_token (env , pausable_token )
6770
@@ -76,16 +79,19 @@ def test_unpause_token_with_invalid_pasue_key(env, pausable_token):
7679 assert unpause_receipt .status == ResponseCode .INVALID_SIGNATURE
7780
7881
82+ @pytest .mark .integration
7983def test_unpause_token_when_token_id_not_set (env ):
8084 """Test unpause transaction when token_id is not provided."""
8185 unpause_tx = TokenUnpauseTransaction ()
82- with pytest .raises (ValueError , match = "Missing token ID" ):
83- unpause_tx .freeze_with (env .client )
86+ with pytest .raises (PrecheckError , match = "failed precheck with status: INVALID_TOKEN_ID" ) as exc_info :
87+ unpause_tx .execute (env .client )
88+ assert exc_info .value .status == ResponseCode .INVALID_TOKEN_ID
8489
8590
91+ @pytest .mark .integration
8692def test_unpause_token_with_invalid_token_id (env ):
8793 """Test unpause transaction using an invalid token ID."""
88- token_id = TokenId (0 , 0 , 999 )
94+ token_id = TokenId (0 , 0 , 0 )
8995
9096 unpause_tx = TokenUnpauseTransaction ().set_token_id (token_id ).freeze_with (env .client ).sign (pause_key )
9197
0 commit comments