Updated Ragger app client for trusted name & sign APDUs

Also added two new optional arguments to pytest :
--gold for screenshot generation
--chainid to specify an alternative app chain ID
This commit is contained in:
Alexandre Paillier
2023-02-27 10:54:36 +01:00
parent 2b463e95aa
commit 37a6dab7be
6 changed files with 133 additions and 5 deletions
+15 -3
View File
@@ -15,8 +15,9 @@ def pytest_addoption(parser):
parser.addoption("--path", action="store", default="./elfs")
parser.addoption("--model", action="store", required=True)
parser.addoption("--display", action="store_true", default=False)
parser.addoption("--chainid", type=int, action="store", default=1)
parser.addoption("--gold", action="store_true", default=False)
# accessing the value of the "--backend" option as a fixture
@pytest.fixture
def arg_backend(pytestconfig) -> str:
return pytestconfig.getoption("backend")
@@ -33,6 +34,14 @@ def arg_model(pytestconfig) -> str:
def arg_display(pytestconfig) -> bool:
return pytestconfig.getoption("display")
@pytest.fixture
def arg_chainid(pytestconfig) -> int:
return pytestconfig.getoption("chainid")
@pytest.fixture
def arg_gold(pytestconfig) -> bool:
return pytestconfig.getoption("gold")
# Providing the firmware as a fixture
@pytest.fixture
def firmware(arg_model: str) -> Firmware:
@@ -41,6 +50,7 @@ def firmware(arg_model: str) -> Firmware:
return fw
raise ValueError("Unknown device model \"%s\"" % (arg_model))
def get_speculos_args(arg_path: str, display: bool, fw: Firmware):
extra_args = list()
@@ -74,5 +84,7 @@ def backend_client(arg_backend: str, arg_path: str, arg_display: bool, firmware:
# This final fixture will return the properly configured app client, to be used in tests
@pytest.fixture
def app_client(backend_client: BackendInterface) -> EthereumClient:
return EthereumClient(backend_client)
def app_client(backend_client: BackendInterface,
arg_chainid: int,
arg_gold: bool) -> EthereumClient:
return EthereumClient(backend_client, arg_chainid, arg_gold)