Port 'test_erc20information' from 'speculos' to 'ragger'
This commit is contained in:
26
tests/ragger/test_erc20information.py
Normal file
26
tests/ragger/test_erc20information.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import pytest
|
||||
from ledger_app_clients.ethereum.client import EthAppClient, StatusWord
|
||||
|
||||
from ragger.error import ExceptionRAPDU
|
||||
from ragger.backend import BackendInterface
|
||||
|
||||
|
||||
def test_provide_erc20_token(backend: BackendInterface):
|
||||
|
||||
app_client = EthAppClient(backend)
|
||||
|
||||
addr = bytes.fromhex("e41d2489571d322189246dafa5ebde1f4699f498")
|
||||
response = app_client.provide_token_metadata("ZRX", addr, 18, 1)
|
||||
assert response.status == StatusWord.OK
|
||||
|
||||
|
||||
def test_provide_erc20_token_error(backend: BackendInterface):
|
||||
|
||||
app_client = EthAppClient(backend)
|
||||
|
||||
addr = bytes.fromhex("e41d2489571d322189246dafa5ebde1f4699f498")
|
||||
sign = bytes.fromhex("deadbeef")
|
||||
with pytest.raises(ExceptionRAPDU) as e:
|
||||
app_client.provide_token_metadata("ZRX", addr, 18, 1, sign)
|
||||
|
||||
assert e.value.status == StatusWord.INVALID_DATA
|
||||
Reference in New Issue
Block a user