From 6bd83aac94f02f9b01455a205c85ceac15633daa Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 4 Mar 2024 13:29:28 +0100 Subject: [PATCH] tests(translations): restore test_error_invalid_signature --- tests/device_tests/test_language.py | 22 ++++++++++++++++++++++ tests/ui_tests/fixtures.json | 10 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/device_tests/test_language.py b/tests/device_tests/test_language.py index 3322aa05cc..7a13bd6cb7 100644 --- a/tests/device_tests/test_language.py +++ b/tests/device_tests/test_language.py @@ -22,6 +22,7 @@ from typing import Any, Iterator import pytest from trezorlib import debuglink, device, exceptions, messages, models +from trezorlib._internal import translations from trezorlib.debuglink import TrezorClientDebugLink as Client from trezorlib.debuglink import message_filters @@ -154,6 +155,27 @@ def test_error_version_mismatch(client: Client): _check_ping_screen_texts(client, get_ping_title("en"), get_ping_button("en")) +def test_error_invalid_signature(client: Client): + assert client.features.language == "en-US" + # Invalid signature + # Changing the data in the signature section + with pytest.raises( + exceptions.TrezorFailure, match="Invalid translations data" + ), client: + blob = prepare_blob("cs", client.model, client.version) + blob.proof = translations.Proof( + merkle_proof=[], + sigmask=0b011, + signature=b"a" * 64, + ) + device.change_language( + client, + language_data=blob.build(), + ) + assert client.features.language == "en-US" + _check_ping_screen_texts(client, get_ping_title("en"), get_ping_button("en")) + + @pytest.mark.parametrize("lang", LANGUAGES) def test_full_language_change(client: Client, lang: str): assert client.features.language == "en-US" diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 9814244b87..ede439c324 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -3649,6 +3649,7 @@ "TR_cs_test_language.py::test_error_invalid_data_hash": "71a89aedd03ff90c662b0190e0d467442b9ba8f75b42737c50eaf4d69817c6fa", "TR_cs_test_language.py::test_error_invalid_data_length": "02e362fe1a3c830bd5cec9a2fde39ad32453800ccc4f3caf00f629813d9b2ce0", "TR_cs_test_language.py::test_error_invalid_header_magic": "02e362fe1a3c830bd5cec9a2fde39ad32453800ccc4f3caf00f629813d9b2ce0", +"TR_cs_test_language.py::test_error_invalid_signature": "02e362fe1a3c830bd5cec9a2fde39ad32453800ccc4f3caf00f629813d9b2ce0", "TR_cs_test_language.py::test_error_too_long": "02e362fe1a3c830bd5cec9a2fde39ad32453800ccc4f3caf00f629813d9b2ce0", "TR_cs_test_language.py::test_error_version_mismatch": "02e362fe1a3c830bd5cec9a2fde39ad32453800ccc4f3caf00f629813d9b2ce0", "TR_cs_test_language.py::test_full_language_change[cs]": "99d0b7bb982c85a962e32412c4c6453c6aea8b82f5d73ea2c306e1e8a831dea5", @@ -5017,6 +5018,7 @@ "TR_de_test_language.py::test_error_invalid_data_hash": "001546a6d7d6fd797f5d358a85afbb653ab3dba0ee15650b38981149460e33ad", "TR_de_test_language.py::test_error_invalid_data_length": "84138ca1475cc52d9eb63b38826db3e857741f4da5194bd58a9fb3632ef9d9d5", "TR_de_test_language.py::test_error_invalid_header_magic": "84138ca1475cc52d9eb63b38826db3e857741f4da5194bd58a9fb3632ef9d9d5", +"TR_de_test_language.py::test_error_invalid_signature": "84138ca1475cc52d9eb63b38826db3e857741f4da5194bd58a9fb3632ef9d9d5", "TR_de_test_language.py::test_error_too_long": "84138ca1475cc52d9eb63b38826db3e857741f4da5194bd58a9fb3632ef9d9d5", "TR_de_test_language.py::test_error_version_mismatch": "84138ca1475cc52d9eb63b38826db3e857741f4da5194bd58a9fb3632ef9d9d5", "TR_de_test_language.py::test_full_language_change[cs]": "b9b49f071757548a9502db2efef0ee7686f130e2a4fa1c01954b13e8a2d4833c", @@ -6385,6 +6387,7 @@ "TR_en_test_language.py::test_error_invalid_data_hash": "0cb01b8002472dff316d6eb3ba901dffb762d88fdf61e5ef8642ca7772d3e71c", "TR_en_test_language.py::test_error_invalid_data_length": "4ffbed72e7ed7fbab85f830952200adf7758af81b658b56de4672344120456a6", "TR_en_test_language.py::test_error_invalid_header_magic": "4ffbed72e7ed7fbab85f830952200adf7758af81b658b56de4672344120456a6", +"TR_en_test_language.py::test_error_invalid_signature": "4ffbed72e7ed7fbab85f830952200adf7758af81b658b56de4672344120456a6", "TR_en_test_language.py::test_error_too_long": "4ffbed72e7ed7fbab85f830952200adf7758af81b658b56de4672344120456a6", "TR_en_test_language.py::test_error_version_mismatch": "4ffbed72e7ed7fbab85f830952200adf7758af81b658b56de4672344120456a6", "TR_en_test_language.py::test_full_language_change[cs]": "ba3669f5c7043e8021d84589d5c173eb1d3f6b2402f1e31525ce832094ca1e20", @@ -7753,6 +7756,7 @@ "TR_es_test_language.py::test_error_invalid_data_hash": "1e4a266ea51d55976cf4a1f8655e58629092b617c9d36e0603a5081961130564", "TR_es_test_language.py::test_error_invalid_data_length": "7fe6f34be4850fe62d0125548db36aa49493f7ef08781916025877445700ccae", "TR_es_test_language.py::test_error_invalid_header_magic": "7fe6f34be4850fe62d0125548db36aa49493f7ef08781916025877445700ccae", +"TR_es_test_language.py::test_error_invalid_signature": "7fe6f34be4850fe62d0125548db36aa49493f7ef08781916025877445700ccae", "TR_es_test_language.py::test_error_too_long": "7fe6f34be4850fe62d0125548db36aa49493f7ef08781916025877445700ccae", "TR_es_test_language.py::test_error_version_mismatch": "7fe6f34be4850fe62d0125548db36aa49493f7ef08781916025877445700ccae", "TR_es_test_language.py::test_full_language_change[cs]": "5499d72b948c2b12fbf42cab072a8fea155a759a144930b7786104b32391e490", @@ -9121,6 +9125,7 @@ "TR_fr_test_language.py::test_error_invalid_data_hash": "c3c594c2d963c7562250b5cae43e6933a6c67c8b7aa7063e58de94e56fdad446", "TR_fr_test_language.py::test_error_invalid_data_length": "cb1cd75e37f30dacba9ccd6d4a9d0ada0179a8ac056340ce16edb802d16fac8c", "TR_fr_test_language.py::test_error_invalid_header_magic": "cb1cd75e37f30dacba9ccd6d4a9d0ada0179a8ac056340ce16edb802d16fac8c", +"TR_fr_test_language.py::test_error_invalid_signature": "cb1cd75e37f30dacba9ccd6d4a9d0ada0179a8ac056340ce16edb802d16fac8c", "TR_fr_test_language.py::test_error_too_long": "cb1cd75e37f30dacba9ccd6d4a9d0ada0179a8ac056340ce16edb802d16fac8c", "TR_fr_test_language.py::test_error_version_mismatch": "cb1cd75e37f30dacba9ccd6d4a9d0ada0179a8ac056340ce16edb802d16fac8c", "TR_fr_test_language.py::test_full_language_change[cs]": "7715e87e6a60006e6d6c61cde25ba2bc88540bd078f56d39ba1919e53e2dba99", @@ -10796,6 +10801,7 @@ "TT_cs_test_language.py::test_error_invalid_data_hash": "f839ad9340a0fbc2c26aeacd077a278c90b1544c62c185f403c4e791b00d232a", "TT_cs_test_language.py::test_error_invalid_data_length": "011d289134e070f0f1b21939ddd9dc8003ab02c8ff29db2db8b349eed7478b92", "TT_cs_test_language.py::test_error_invalid_header_magic": "011d289134e070f0f1b21939ddd9dc8003ab02c8ff29db2db8b349eed7478b92", +"TT_cs_test_language.py::test_error_invalid_signature": "011d289134e070f0f1b21939ddd9dc8003ab02c8ff29db2db8b349eed7478b92", "TT_cs_test_language.py::test_error_too_long": "011d289134e070f0f1b21939ddd9dc8003ab02c8ff29db2db8b349eed7478b92", "TT_cs_test_language.py::test_error_version_mismatch": "011d289134e070f0f1b21939ddd9dc8003ab02c8ff29db2db8b349eed7478b92", "TT_cs_test_language.py::test_full_language_change[cs]": "b837b129f22886f15e2cf5183adc44561ba24de2848097fbbbfc6c44fd34728d", @@ -12244,6 +12250,7 @@ "TT_de_test_language.py::test_error_invalid_data_hash": "449c596f93b1a7833e9631c0d8fe1f3f09eb64f3bf6006cf0ed22f08d051e263", "TT_de_test_language.py::test_error_invalid_data_length": "aa98140621cbb05cbaaad67e2fbaeba12f6d5ece97cb5cef993b6a263cce38b2", "TT_de_test_language.py::test_error_invalid_header_magic": "aa98140621cbb05cbaaad67e2fbaeba12f6d5ece97cb5cef993b6a263cce38b2", +"TT_de_test_language.py::test_error_invalid_signature": "aa98140621cbb05cbaaad67e2fbaeba12f6d5ece97cb5cef993b6a263cce38b2", "TT_de_test_language.py::test_error_too_long": "aa98140621cbb05cbaaad67e2fbaeba12f6d5ece97cb5cef993b6a263cce38b2", "TT_de_test_language.py::test_error_version_mismatch": "aa98140621cbb05cbaaad67e2fbaeba12f6d5ece97cb5cef993b6a263cce38b2", "TT_de_test_language.py::test_full_language_change[cs]": "14d372b0e5e896a15209b36c23196fa2b445124ff07eac3e8e550f79ef53fc52", @@ -13692,6 +13699,7 @@ "TT_en_test_language.py::test_error_invalid_data_hash": "67782b952469c260afac92bac1efc2ba9c2f342319ae95fb5e91c843da2a6e46", "TT_en_test_language.py::test_error_invalid_data_length": "d702b0f90581cf17e0f77b4d318324a002deec42c2c5cb8860d51f6cb50f5739", "TT_en_test_language.py::test_error_invalid_header_magic": "d702b0f90581cf17e0f77b4d318324a002deec42c2c5cb8860d51f6cb50f5739", +"TT_en_test_language.py::test_error_invalid_signature": "d702b0f90581cf17e0f77b4d318324a002deec42c2c5cb8860d51f6cb50f5739", "TT_en_test_language.py::test_error_too_long": "d702b0f90581cf17e0f77b4d318324a002deec42c2c5cb8860d51f6cb50f5739", "TT_en_test_language.py::test_error_version_mismatch": "d702b0f90581cf17e0f77b4d318324a002deec42c2c5cb8860d51f6cb50f5739", "TT_en_test_language.py::test_full_language_change[cs]": "1359095f8b87e599c6fd88c15dd257c09c4afb3095d4db671e1746dfc4017604", @@ -15158,6 +15166,7 @@ "TT_es_test_language.py::test_error_invalid_data_hash": "1af05b4747855d9479d1d34bd3f1bc17cfe57f60a5c7bfdb4e93ceb331f13b2b", "TT_es_test_language.py::test_error_invalid_data_length": "cece2fdd44e917f03f20485e030d2ae3a614143360ce784cc7a3f43da9751f46", "TT_es_test_language.py::test_error_invalid_header_magic": "cece2fdd44e917f03f20485e030d2ae3a614143360ce784cc7a3f43da9751f46", +"TT_es_test_language.py::test_error_invalid_signature": "cece2fdd44e917f03f20485e030d2ae3a614143360ce784cc7a3f43da9751f46", "TT_es_test_language.py::test_error_too_long": "cece2fdd44e917f03f20485e030d2ae3a614143360ce784cc7a3f43da9751f46", "TT_es_test_language.py::test_error_version_mismatch": "cece2fdd44e917f03f20485e030d2ae3a614143360ce784cc7a3f43da9751f46", "TT_es_test_language.py::test_full_language_change[cs]": "a786fa6053511bd1be10fd59016991fa079e8ee3c565d6533568d690541412e3", @@ -16606,6 +16615,7 @@ "TT_fr_test_language.py::test_error_invalid_data_hash": "43d82fabe548153d7cbde335cd0e80ac0d444ba58628b0a4fef503817d2fb82b", "TT_fr_test_language.py::test_error_invalid_data_length": "cf1b79fdfa5643710dabe6a0dc9abc8ebf227f617e7bc2214bcffe465dc81670", "TT_fr_test_language.py::test_error_invalid_header_magic": "cf1b79fdfa5643710dabe6a0dc9abc8ebf227f617e7bc2214bcffe465dc81670", +"TT_fr_test_language.py::test_error_invalid_signature": "cf1b79fdfa5643710dabe6a0dc9abc8ebf227f617e7bc2214bcffe465dc81670", "TT_fr_test_language.py::test_error_too_long": "cf1b79fdfa5643710dabe6a0dc9abc8ebf227f617e7bc2214bcffe465dc81670", "TT_fr_test_language.py::test_error_version_mismatch": "cf1b79fdfa5643710dabe6a0dc9abc8ebf227f617e7bc2214bcffe465dc81670", "TT_fr_test_language.py::test_full_language_change[cs]": "447d14f4f54f2b9e7f894514770d73a47958503a93983fb48b8f54f2c8e1fa8a",