Skip to content

Commit

Permalink
Tests: add a test check transaction cannot be signed
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Feb 6, 2024
1 parent e53f65e commit d336881
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/python/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
from pathlib import Path
from typing import Callable, Tuple
import pytest
from pytezos import pytezos
from ragger.firmware import Firmware
from ragger.navigator import NavInsID
from utils.client import TezosClient, Version, Hwm, StatusCode
from utils.account import Account
from utils.helper import get_current_commit
from utils.message import (
Message,
UnsafeOp,
Delegation,
Preattestation,
Attestation,
Expand Down Expand Up @@ -709,6 +711,36 @@ def test_sign_not_authorized_key(
client.sign_message(account_2, attestation)


def test_sign_transaction(
client: TezosClient,
tezos_navigator: TezosNavigator) -> None:
"""Check that signing a transaction is not allowed."""

account_1 = DEFAULT_ACCOUNT
account_2 = DEFAULT_ACCOUNT_2

main_chain_id = DEFAULT_CHAIN_ID

tezos_navigator.setup_app_context(
account_1,
main_chain_id,
main_hwm=Hwm(0),
test_hwm=Hwm(0)
)

ctxt = pytezos.using()
transaction = UnsafeOp(
ctxt.transaction(
source=account_1.public_key_hash,
destination=account_2.public_key_hash,
amount=10_000,
)
).forge()

with StatusCode.PARSE_ERROR.expected():
client.sign_message(account_1, transaction)


def test_sign_when_no_chain_setup(
client: TezosClient,
tezos_navigator: TezosNavigator) -> None:
Expand Down

0 comments on commit d336881

Please sign in to comment.