Skip to content

Commit e93df73

Browse files
committed
feat: unit tests in token create for pause key
1 parent 6e952ef commit e93df73

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/unit/test_token_create_transaction.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ def test_sign_transaction(mock_account_ids, mock_client):
260260
private_key_freeze.sign.return_value = b"freeze_signature"
261261
private_key_freeze.public_key().to_bytes_raw.return_value = b"freeze_public_key"
262262

263+
private_key_pause = MagicMock()
264+
private_key_pause.sign.return_value = b"pause_signature"
265+
private_key_pause.public_key().to_bytes_raw.return_value = b"pause_public_key"
266+
263267
token_tx = TokenCreateTransaction()
264268
token_tx.set_token_name("MyToken")
265269
token_tx.set_token_symbol("MTK")
@@ -269,6 +273,7 @@ def test_sign_transaction(mock_account_ids, mock_client):
269273
token_tx.set_admin_key(private_key_admin)
270274
token_tx.set_supply_key(private_key_supply)
271275
token_tx.set_freeze_key(private_key_freeze)
276+
token_tx.set_pause_key(private_key_pause)
272277

273278
token_tx.transaction_id = generate_transaction_id(treasury_account)
274279

@@ -294,7 +299,11 @@ def test_sign_transaction(mock_account_ids, mock_client):
294299

295300
# Confirm that neither sigPair belongs to supply_key or freeze_key:
296301
for sig_pair in token_tx._signature_map[body_bytes].sigPair:
297-
assert sig_pair.pubKeyPrefix not in (b"supply_public_key", b"freeze_public_key")
302+
assert sig_pair.pubKeyPrefix not in (
303+
b"supply_public_key",
304+
b"freeze_public_key",
305+
b"pause_public_key"
306+
)
298307

299308
# This test uses fixture (mock_account_ids, mock_client) as parameter
300309
def test_to_proto_without_keys(mock_account_ids, mock_client):
@@ -653,6 +662,10 @@ def test_build_and_sign_nft_transaction_to_proto(mock_account_ids, mock_client):
653662
private_key_freeze.sign.return_value = b"freeze_signature"
654663
private_key_freeze.public_key().to_bytes_raw.return_value = b"freeze_public_key"
655664

665+
private_key_pause = MagicMock()
666+
private_key_pause.sign.return_value = b"pause_signature"
667+
private_key_pause.public_key().to_bytes_raw.return_value = b"pause_public_key"
668+
656669
# Build the transaction
657670
token_tx = TokenCreateTransaction()
658671
token_tx.set_token_name("MyNFTToken")
@@ -664,6 +677,7 @@ def test_build_and_sign_nft_transaction_to_proto(mock_account_ids, mock_client):
664677
token_tx.set_admin_key(private_key_admin)
665678
token_tx.set_supply_key(private_key_supply)
666679
token_tx.set_freeze_key(private_key_freeze)
680+
token_tx.set_pause_key(private_key_pause)
667681

668682
token_tx.transaction_id = generate_transaction_id(treasury_account)
669683

@@ -699,6 +713,7 @@ def test_build_and_sign_nft_transaction_to_proto(mock_account_ids, mock_client):
699713
assert tx_body.tokenCreation.adminKey.ed25519 == b"admin_public_key"
700714
assert tx_body.tokenCreation.supplyKey.ed25519 == b"supply_public_key"
701715
assert tx_body.tokenCreation.freezeKey.ed25519 == b"freeze_public_key"
716+
assert tx_body.tokenCreation.pause_key.ed25519 == b"pause_public_key"
702717

703718
@pytest.mark.parametrize(
704719
"token_type, supply_type, max_supply, initial_supply, expected_error",

0 commit comments

Comments
 (0)