2024-03-29 10:38:31 +01:00
|
|
|
import pytest
|
2024-04-09 10:26:17 +02:00
|
|
|
|
2024-03-29 10:38:31 +01:00
|
|
|
from ragger.error import ExceptionRAPDU
|
|
|
|
|
from ragger.backend import BackendInterface
|
|
|
|
|
|
2024-04-30 17:34:57 +02:00
|
|
|
from client.client import EthAppClient, StatusWord
|
|
|
|
|
|
2024-03-29 10:38:31 +01:00
|
|
|
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")
|
2024-06-11 10:59:14 +02:00
|
|
|
with pytest.raises(ExceptionRAPDU) as err:
|
2024-03-29 10:38:31 +01:00
|
|
|
app_client.provide_token_metadata("ZRX", addr, 18, 1, sign)
|
|
|
|
|
|
2024-06-11 10:59:14 +02:00
|
|
|
assert err.value.status == StatusWord.INVALID_DATA
|