What changed, and why it matters
This commit is a simple revert of a previous test-only change. It modifies one Python test file to go back to an older way of looking up translated strings during automated device tests. There is no change to the actual Trezor firmware code that runs on the hardware, so this cannot affect real users or device security.
No security action needed. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit reverts baae34149b9a26af36855de8ba518b642185b6eb in tests/device_tests/test_language.py. It removes the use of a helper named translate() and instead reads strings directly from per-language JSON via get_lang_json(lang). It also updates call sites to pass an explicit language code and removes one redundant set_language() call in test_header_trailing_data. The diff is entirely within the test suite; no firmware/runtime code is changed.
Changed components
tests/device_tests/test_language.pyInspect captured patch +24 / −24
diff --git a/tests/device_tests/test_language.py b/tests/device_tests/test_language.py
index 0e077a9d4..cc1a30baf 100644
--- a/tests/device_tests/test_language.py
+++ b/tests/device_tests/test_language.py
@@ -34,7 +34,6 @@ from ..translations import (
prepare_blob,
set_language,
sign_blob,
- translate,
)
pytestmark = pytest.mark.models("core")
@@ -49,12 +48,14 @@ MAX_DATA_LENGTH = {
}
-def get_ping_button() -> str:
- return translate("buttons__confirm")
+def get_ping_button(lang: str) -> str:
+ content = get_lang_json(lang)
+ return content["translations"]["buttons__confirm"]
-def get_ping_title() -> str:
- return translate("words__confirm")
+def get_ping_title(lang: str) -> str:
+ content = get_lang_json(lang)
+ return content["translations"]["words__confirm"]
@pytest.fixture
@@ -88,7 +89,7 @@ def _check_ping_screen_texts(session: Session, title: str, right_button: str) ->
assert layout.button_contents()[-1].upper() == right_button.upper()
session.client.debug.press_yes()
- # T2T1 does not have a right button text (but a green OK tick)
+ # TT does not have a right button text (but a green OK tick)
if session.model in (models.T2T1, models.T3T1):
right_button = "-"
@@ -110,7 +111,7 @@ def test_error_too_long(session: Session):
bad_data = (max_length + 1) * b"a"
device.change_language(session, language_data=bad_data)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_error_invalid_data_length(session: Session):
@@ -124,7 +125,7 @@ def test_error_invalid_data_length(session: Session):
bad_data = good_data + b"abcd"
device.change_language(session, language_data=bad_data)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_error_invalid_header_magic(session: Session):
@@ -138,7 +139,7 @@ def test_error_invalid_header_magic(session: Session):
bad_data = 4 * b"a" + good_data[4:]
device.change_language(session, language_data=bad_data)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_error_invalid_data_hash(session: Session):
@@ -155,7 +156,7 @@ def test_error_invalid_data_hash(session: Session):
language_data=bad_data,
)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_error_version_mismatch(session: Session):
@@ -171,7 +172,7 @@ def test_error_version_mismatch(session: Session):
language_data=sign_blob(blob),
)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_error_invalid_signature(session: Session):
@@ -192,7 +193,7 @@ def test_error_invalid_signature(session: Session):
language_data=blob.build(),
)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
@pytest.mark.parametrize("lang", LANGUAGES)
@@ -204,26 +205,26 @@ def test_full_language_change(session: Session, lang: str):
set_language(session, lang)
assert session.features.language[:2] == lang
assert session.features.language_version_matches is True
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title(lang), get_ping_button(lang))
# Setting the default language via empty data
set_language(session, "en")
assert session.features.language == "en-US"
assert session.features.language_version_matches is True
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_language_is_removed_after_wipe(client: Client):
session = client.get_session()
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
# Setting cs language
set_language(session, "cs")
assert session.features.language == "cs-CZ"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("cs"), get_ping_button("cs"))
# Wipe device
device.wipe(session)
@@ -241,7 +242,7 @@ def test_language_is_removed_after_wipe(client: Client):
)
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def test_translations_renders_on_screen(session: Session):
@@ -252,12 +253,12 @@ def test_translations_renders_on_screen(session: Session):
assert session.features.language == "en-US"
# Normal english
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
# Normal czech
set_language(session, "cs")
assert session.features.language == "cs-CZ"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("cs"), get_ping_button("cs"))
# Modified czech - changed value
czech_data_copy = deepcopy(czech_data)
@@ -267,7 +268,7 @@ def test_translations_renders_on_screen(session: Session):
session,
language_data=build_and_sign_blob(czech_data_copy, session),
)
- _check_ping_screen_texts(session, new_czech_confirm, get_ping_button())
+ _check_ping_screen_texts(session, new_czech_confirm, get_ping_button("cs"))
# Modified czech - key deleted completely, english is shown
czech_data_copy = deepcopy(czech_data)
@@ -276,7 +277,7 @@ def test_translations_renders_on_screen(session: Session):
session,
language_data=build_and_sign_blob(czech_data_copy, session),
)
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("cs"))
def test_reject_update(session: Session):
@@ -295,7 +296,7 @@ def test_reject_update(session: Session):
assert session.features.language == "en-US"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title("en"), get_ping_button("en"))
def _maybe_confirm_set_language(
@@ -411,6 +412,5 @@ def test_header_trailing_data(session: Session):
language_data = sign_blob(blob)
device.change_language(session, language_data)
- set_language(session, "cs")
assert session.features.language == "cs-CZ"
- _check_ping_screen_texts(session, get_ping_title(), get_ping_button())
+ _check_ping_screen_texts(session, get_ping_title(lang), get_ping_button(lang))
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.