mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-25 00:48:19 +00:00
tests: make testpy tries running selected tests from python-trezor
apps.ethereum: fix get address call
This commit is contained in:
parent
1cd0609ac2
commit
918150a3f1
3
Makefile
3
Makefile
@ -61,6 +61,9 @@ clean_cross: ## clean mpy-cross build
|
||||
test: ## run unit tests
|
||||
cd tests ; ./run_tests.sh
|
||||
|
||||
testpy: ## run selected unit tests from python-trezor
|
||||
cd tests ; ./run_tests_python_trezor.sh
|
||||
|
||||
flash: ## flash firmware using st-flash
|
||||
st-flash write $(STMHAL_BUILD_DIR)/firmware0.bin 0x8000000
|
||||
sleep 0.1
|
||||
|
@ -9,8 +9,7 @@ async def layout_ethereum_get_address(msg, session_id):
|
||||
from trezor.crypto.hashlib import sha3_256
|
||||
from ..common.seed import get_node
|
||||
|
||||
address_n = getattr(msg, 'address_n', ())
|
||||
show_display = getattr(msg, 'show_display', False)
|
||||
address_n = msg.address_n or ()
|
||||
|
||||
node = await get_node(session_id, address_n)
|
||||
|
||||
@ -18,7 +17,7 @@ async def layout_ethereum_get_address(msg, session_id):
|
||||
public_key = secp256k1.publickey(seckey, False) # uncompressed
|
||||
address = sha3_256(public_key[1:]).digest(True)[12:] # Keccak
|
||||
|
||||
if show_display:
|
||||
if msg.show_display:
|
||||
await _show_address(session_id, address)
|
||||
return EthereumAddress(address=address)
|
||||
|
||||
|
1
tests/.gitignore
vendored
Normal file
1
tests/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
python-trezor/
|
41
tests/run_tests_python_trezor.sh
Executable file
41
tests/run_tests_python_trezor.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d python-trezor ]; then
|
||||
cd python-trezor ; git pull ; cd ..
|
||||
else
|
||||
git clone https://github.com/trezor/python-trezor.git
|
||||
fi
|
||||
|
||||
# run emulator
|
||||
|
||||
cd ../src
|
||||
../vendor/micropython/unix/micropython -O0 main.py &
|
||||
UPY_PID=$!
|
||||
|
||||
sleep 1
|
||||
|
||||
cd ../tests/python-trezor/tests
|
||||
export PYTHONPATH=".."
|
||||
|
||||
error=0
|
||||
|
||||
for i in \
|
||||
test_msg_cipherkeyvalue.py \
|
||||
test_msg_estimatetxsize.py \
|
||||
test_msg_ethereum_getaddress.py \
|
||||
test_msg_getaddress.py \
|
||||
test_msg_getpublickey.py \
|
||||
test_msg_signmessage.py \
|
||||
test_msg_signtx.py \
|
||||
test_msg_verifymessage.py \
|
||||
; do
|
||||
if ! python2 $i ; then
|
||||
error=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# kill emulator
|
||||
kill $UPY_PID
|
||||
|
||||
exit $error
|
Loading…
Reference in New Issue
Block a user