EIP-712 Ragger tests snapshots handling

Also moved snapshots root path to a centralized/common file
This commit is contained in:
Alexandre Paillier
2024-01-30 11:47:44 +01:00
parent d24d630541
commit c8c6b9a2d1
5 changed files with 23 additions and 14 deletions

View File

@@ -1,6 +1,5 @@
import pytest
from typing import Optional
from pathlib import Path
from ragger.error import ExceptionRAPDU
from ragger.firmware import Firmware
from ragger.backend import BackendInterface
@@ -8,8 +7,7 @@ from ragger.navigator import Navigator, NavInsID
from ledger_app_clients.ethereum.client import EthAppClient, StatusWord
import ledger_app_clients.ethereum.response_parser as ResponseParser
from ragger.bip import calculate_public_key_and_chaincode, CurveChoice
ROOT_SCREENSHOT_PATH = Path(__file__).parent
from constants import ROOT_SNAPSHOT_PATH
@pytest.fixture(params=[True, False])
@@ -56,7 +54,7 @@ def test_get_pk_rejected(firmware: Firmware,
try:
with app_client.get_public_addr():
navigator.navigate_and_compare(ROOT_SCREENSHOT_PATH,
navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH,
"get_pk_rejected",
get_moves(firmware, navigator, reject=True))
except ExceptionRAPDU as e:
@@ -73,7 +71,7 @@ def test_get_pk(firmware: Firmware,
app_client = EthAppClient(backend)
with app_client.get_public_addr(chaincode=with_chaincode, chain_id=chain):
navigator.navigate_and_compare(ROOT_SCREENSHOT_PATH,
navigator.navigate_and_compare(ROOT_SNAPSHOT_PATH,
"get_pk_%s" % (chain),
get_moves(firmware, navigator, chain=chain))
pk, addr, chaincode = ResponseParser.pk_addr(app_client.response().data, with_chaincode)