From 9c75e27433896151db8ef3c19611def06e70beb6 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 31 Jan 2020 16:58:01 +0100 Subject: [PATCH] tests: unify Ping replacements for raw calls: just messages.GetAddress() for library calls: btc.get_address(client, "Testnet", [0]) --- tests/device_tests/test_debuglink.py | 2 +- .../device_tests/test_msg_recoverydevice_bip39.py | 4 ++-- tests/device_tests/test_msg_resetdevice_bip39.py | 4 ++-- tests/device_tests/test_protection_levels.py | 14 ++++++-------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/device_tests/test_debuglink.py b/tests/device_tests/test_debuglink.py index 430d3514f5..edfeff8209 100644 --- a/tests/device_tests/test_debuglink.py +++ b/tests/device_tests/test_debuglink.py @@ -34,7 +34,7 @@ class TestDebuglink: @pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase=True) def test_pin(self, client): - resp = client.call_raw(messages.GetAddress(address_n=[], coin_name="Testnet")) + resp = client.call_raw(messages.GetAddress()) assert isinstance(resp, messages.PinMatrixRequest) pin, matrix = client.debug.read_pin() diff --git a/tests/device_tests/test_msg_recoverydevice_bip39.py b/tests/device_tests/test_msg_recoverydevice_bip39.py index 38342b7e1c..07782f05c0 100644 --- a/tests/device_tests/test_msg_recoverydevice_bip39.py +++ b/tests/device_tests/test_msg_recoverydevice_bip39.py @@ -85,7 +85,7 @@ class TestMsgRecoverydevice: assert client.features.passphrase_protection is True # Do passphrase-protected action, PassphraseRequest should be raised - resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet")) + resp = client.call_raw(proto.GetAddress()) assert isinstance(resp, proto.PassphraseRequest) client.call_raw(proto.Cancel()) @@ -137,7 +137,7 @@ class TestMsgRecoverydevice: assert client.features.passphrase_protection is False # Do pin & passphrase-protected action, PassphraseRequest should NOT be raised - resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet")) + resp = client.call_raw(proto.GetAddress()) assert isinstance(resp, proto.Address) @pytest.mark.setup_client(uninitialized=True) diff --git a/tests/device_tests/test_msg_resetdevice_bip39.py b/tests/device_tests/test_msg_resetdevice_bip39.py index f09320717d..eab5c0d34d 100644 --- a/tests/device_tests/test_msg_resetdevice_bip39.py +++ b/tests/device_tests/test_msg_resetdevice_bip39.py @@ -88,7 +88,7 @@ class TestMsgResetDevice: assert resp.passphrase_protection is False # Do pin & passphrase-protected action, PassphraseRequest should NOT be raised - resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet")) + resp = client.call_raw(proto.GetAddress()) assert isinstance(resp, proto.Address) @pytest.mark.setup_client(uninitialized=True) @@ -176,7 +176,7 @@ class TestMsgResetDevice: assert resp.passphrase_protection is True # Do passphrase-protected action, PassphraseRequest should be raised - resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet")) + resp = client.call_raw(proto.GetAddress()) assert isinstance(resp, proto.PassphraseRequest) client.call_raw(proto.Cancel()) diff --git a/tests/device_tests/test_protection_levels.py b/tests/device_tests/test_protection_levels.py index 8e7eb67561..d4db71f3ef 100644 --- a/tests/device_tests/test_protection_levels.py +++ b/tests/device_tests/test_protection_levels.py @@ -261,23 +261,21 @@ class TestProtectionLevels: assert client.features.pin_cached is False with client: - client.set_expected_responses( - [proto.PinMatrixRequest(), proto.ButtonRequest(), proto.Address()] - ) - btc.get_address(client, "Bitcoin", [], show_display=True) + client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()]) + btc.get_address(client, "Testnet", [0]) client.init_device() assert client.features.pin_cached is True with client: - client.set_expected_responses([proto.ButtonRequest(), proto.Address()]) - btc.get_address(client, "Bitcoin", [], show_display=True) + client.set_expected_responses([proto.Address()]) + btc.get_address(client, "Testnet", [0]) @pytest.mark.setup_client(passphrase=True) def test_passphrase_cached(self, client): with client: client.set_expected_responses([proto.PassphraseRequest(), proto.Address()]) - btc.get_address(client, "Bitcoin", []) + btc.get_address(client, "Testnet", [0]) with client: client.set_expected_responses([proto.Address()]) - btc.get_address(client, "Bitcoin", []) + btc.get_address(client, "Testnet", [0])