From bb8d809a6d0a08a7ccefe93f06461000dee178c8 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 7 Dec 2019 12:11:51 +0100 Subject: [PATCH] common: change language field to IETF BCP 47 language tag --- common/protob/messages-management.proto | 6 +++--- core/src/apps/homescreen/__init__.py | 2 +- core/src/trezor/messages/LoadDevice.py | 2 +- core/src/trezor/messages/RecoveryDevice.py | 2 +- core/src/trezor/messages/ResetDevice.py | 2 +- legacy/firmware/config.c | 14 ++++++++++++-- python/src/trezorlib/cli/device.py | 6 +++--- python/src/trezorlib/debuglink.py | 2 +- python/src/trezorlib/device.py | 4 ++-- python/src/trezorlib/messages/LoadDevice.py | 2 +- python/src/trezorlib/messages/RecoveryDevice.py | 2 +- python/src/trezorlib/messages/ResetDevice.py | 2 +- tests/conftest.py | 2 +- tests/device_tests/test_msg_applysettings.py | 4 ++-- tests/device_tests/test_msg_backup_device.py | 2 +- tests/device_tests/test_msg_cardano_get_address.py | 3 +-- tests/device_tests/test_msg_loaddevice.py | 8 ++++---- .../device_tests/test_msg_recoverydevice_bip39.py | 10 +++++----- .../test_msg_recoverydevice_bip39_t2.py | 2 +- ...st_msg_recoverydevice_slip39_advanced_dryrun.py | 4 ++-- .../test_msg_recoverydevice_slip39_basic_dryrun.py | 4 ++-- tests/device_tests/test_msg_resetdevice_bip39.py | 8 ++++---- .../test_msg_resetdevice_bip39_skipbackup.py | 6 +++--- .../device_tests/test_msg_resetdevice_bip39_t2.py | 6 +++--- .../test_msg_resetdevice_slip39_advanced.py | 2 +- .../test_msg_resetdevice_slip39_basic.py | 2 +- tests/device_tests/test_msg_ripple_get_address.py | 2 +- tests/device_tests/test_protection_levels.py | 8 ++++---- tests/device_tests/test_reset_recovery_bip39.py | 2 +- .../test_reset_recovery_slip39_advanced.py | 2 +- .../test_reset_recovery_slip39_basic.py | 2 +- tests/upgrade_tests/test_firmware_upgrades.py | 10 +++++----- vendor/fido2-tests | 2 +- 33 files changed, 73 insertions(+), 64 deletions(-) diff --git a/common/protob/messages-management.proto b/common/protob/messages-management.proto index bf19c94f4..8b7f0b215 100644 --- a/common/protob/messages-management.proto +++ b/common/protob/messages-management.proto @@ -227,7 +227,7 @@ message LoadDevice { repeated string mnemonics = 1; // seed encoded as mnemonic (12, 18 or 24 words for BIP39, 20 or 33 for SLIP39) optional string pin = 3; // set PIN protection optional bool passphrase_protection = 4; // enable master node encryption using passphrase - optional string language = 5 [default='english']; // device language + optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag) optional string label = 6; // device label optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum optional uint32 u2f_counter = 8; // U2F counter @@ -246,7 +246,7 @@ message ResetDevice { optional uint32 strength = 2 [default=256]; // strength of seed in bits optional bool passphrase_protection = 3; // enable master node encryption using passphrase optional bool pin_protection = 4; // enable PIN protection - optional string language = 5 [default='english']; // device language + optional string language = 5 [default='en-US']; // device language (IETF BCP 47 language tag) optional string label = 6; // device label optional uint32 u2f_counter = 7; // U2F counter optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow @@ -287,7 +287,7 @@ message RecoveryDevice { optional uint32 word_count = 1; // number of words in BIP-39 mnemonic optional bool passphrase_protection = 2; // enable master node encryption using passphrase optional bool pin_protection = 3; // enable PIN protection - optional string language = 4 [default='english']; // device language + optional string language = 4 [default='en-US']; // device language (IETF BCP 47 language tag) optional string label = 5; // device label optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process // 7 reserved for unused recovery method diff --git a/core/src/apps/homescreen/__init__.py b/core/src/apps/homescreen/__init__.py index 59669706e..db711fd11 100644 --- a/core/src/apps/homescreen/__init__.py +++ b/core/src/apps/homescreen/__init__.py @@ -23,7 +23,7 @@ if False: def get_features() -> Features: f = Features() f.vendor = "trezor.io" - f.language = "english" + f.language = "en-US" f.major_version = utils.VERSION_MAJOR f.minor_version = utils.VERSION_MINOR f.patch_version = utils.VERSION_PATCH diff --git a/core/src/trezor/messages/LoadDevice.py b/core/src/trezor/messages/LoadDevice.py index a9d19c2ff..18ebd512a 100644 --- a/core/src/trezor/messages/LoadDevice.py +++ b/core/src/trezor/messages/LoadDevice.py @@ -41,7 +41,7 @@ class LoadDevice(p.MessageType): 1: ('mnemonics', p.UnicodeType, p.FLAG_REPEATED), 3: ('pin', p.UnicodeType, 0), 4: ('passphrase_protection', p.BoolType, 0), - 5: ('language', p.UnicodeType, 0), # default=english + 5: ('language', p.UnicodeType, 0), # default=en-US 6: ('label', p.UnicodeType, 0), 7: ('skip_checksum', p.BoolType, 0), 8: ('u2f_counter', p.UVarintType, 0), diff --git a/core/src/trezor/messages/RecoveryDevice.py b/core/src/trezor/messages/RecoveryDevice.py index 2aab37909..0d12b8004 100644 --- a/core/src/trezor/messages/RecoveryDevice.py +++ b/core/src/trezor/messages/RecoveryDevice.py @@ -42,7 +42,7 @@ class RecoveryDevice(p.MessageType): 1: ('word_count', p.UVarintType, 0), 2: ('passphrase_protection', p.BoolType, 0), 3: ('pin_protection', p.BoolType, 0), - 4: ('language', p.UnicodeType, 0), # default=english + 4: ('language', p.UnicodeType, 0), # default=en-US 5: ('label', p.UnicodeType, 0), 6: ('enforce_wordlist', p.BoolType, 0), 8: ('type', p.EnumType("RecoveryDeviceType", (0, 1)), 0), diff --git a/core/src/trezor/messages/ResetDevice.py b/core/src/trezor/messages/ResetDevice.py index abe192ae1..3e32b64bc 100644 --- a/core/src/trezor/messages/ResetDevice.py +++ b/core/src/trezor/messages/ResetDevice.py @@ -45,7 +45,7 @@ class ResetDevice(p.MessageType): 2: ('strength', p.UVarintType, 0), # default=256 3: ('passphrase_protection', p.BoolType, 0), 4: ('pin_protection', p.BoolType, 0), - 5: ('language', p.UnicodeType, 0), # default=english + 5: ('language', p.UnicodeType, 0), # default=en-US 6: ('label', p.UnicodeType, 0), 7: ('u2f_counter', p.UVarintType, 0), 8: ('skip_backup', p.BoolType, 0), diff --git a/legacy/firmware/config.c b/legacy/firmware/config.c index 98a1e907b..485ac8616 100644 --- a/legacy/firmware/config.c +++ b/legacy/firmware/config.c @@ -520,7 +520,7 @@ void config_setLanguage(const char *lang) { } // Sanity check. - if (strcmp(lang, "english") != 0) { + if (strcmp(lang, "en-US") != 0) { return; } storage_set(KEY_LANGUAGE, lang, strnlen(lang, MAX_LANGUAGE_LEN)); @@ -665,7 +665,17 @@ bool config_getLabel(char *dest, uint16_t dest_size) { } bool config_getLanguage(char *dest, uint16_t dest_size) { - return sectrue == config_get_string(KEY_LANGUAGE, dest, dest_size); + if (sectrue == config_get_string(KEY_LANGUAGE, dest, dest_size)) { + if (dest_size == 7 && (strcmp(dest, "english") != 0)) { + // fallthrough -> return "en-US" + } else { + // other language -> return the value + return true; + } + } + strcpy(dest, "en-US"); + dest_size = 5; + return true; } bool config_getHomescreen(uint8_t *dest, uint16_t dest_size) { diff --git a/python/src/trezorlib/cli/device.py b/python/src/trezorlib/cli/device.py index 8f9557c86..be79f8534 100644 --- a/python/src/trezorlib/cli/device.py +++ b/python/src/trezorlib/cli/device.py @@ -129,7 +129,7 @@ def load( pin=pin, passphrase_protection=passphrase_protection, label=label, - language="english", + language="en-US", skip_checksum=ignore_checksum, needs_backup=needs_backup, no_backup=no_backup, @@ -170,7 +170,7 @@ def recover( passphrase_protection=passphrase_protection, pin_protection=pin_protection, label=label, - language="english", + language="en-US", input_callback=input_callback, type=rec_type, dry_run=dry_run, @@ -224,7 +224,7 @@ def setup( passphrase_protection=passphrase_protection, pin_protection=pin_protection, label=label, - language="english", + language="en-US", u2f_counter=u2f_counter, skip_backup=skip_backup, no_backup=no_backup, diff --git a/python/src/trezorlib/debuglink.py b/python/src/trezorlib/debuglink.py index d0a4c6676..ff7721c53 100644 --- a/python/src/trezorlib/debuglink.py +++ b/python/src/trezorlib/debuglink.py @@ -456,7 +456,7 @@ def load_device( pin, passphrase_protection, label, - language="english", + language="en-US", skip_checksum=False, needs_backup=False, no_backup=False, diff --git a/python/src/trezorlib/device.py b/python/src/trezorlib/device.py index f95836137..ddd89ba2b 100644 --- a/python/src/trezorlib/device.py +++ b/python/src/trezorlib/device.py @@ -117,7 +117,7 @@ def recover( passphrase_protection=False, pin_protection=True, label=None, - language="english", + language="en-US", input_callback=None, type=messages.RecoveryDeviceType.ScrambledWords, dry_run=False, @@ -171,7 +171,7 @@ def reset( passphrase_protection=False, pin_protection=True, label=None, - language="english", + language="en-US", u2f_counter=0, skip_backup=False, no_backup=False, diff --git a/python/src/trezorlib/messages/LoadDevice.py b/python/src/trezorlib/messages/LoadDevice.py index d9eef5e7f..0226453af 100644 --- a/python/src/trezorlib/messages/LoadDevice.py +++ b/python/src/trezorlib/messages/LoadDevice.py @@ -41,7 +41,7 @@ class LoadDevice(p.MessageType): 1: ('mnemonics', p.UnicodeType, p.FLAG_REPEATED), 3: ('pin', p.UnicodeType, 0), 4: ('passphrase_protection', p.BoolType, 0), - 5: ('language', p.UnicodeType, 0), # default=english + 5: ('language', p.UnicodeType, 0), # default=en-US 6: ('label', p.UnicodeType, 0), 7: ('skip_checksum', p.BoolType, 0), 8: ('u2f_counter', p.UVarintType, 0), diff --git a/python/src/trezorlib/messages/RecoveryDevice.py b/python/src/trezorlib/messages/RecoveryDevice.py index 4f94b43fb..380b03260 100644 --- a/python/src/trezorlib/messages/RecoveryDevice.py +++ b/python/src/trezorlib/messages/RecoveryDevice.py @@ -42,7 +42,7 @@ class RecoveryDevice(p.MessageType): 1: ('word_count', p.UVarintType, 0), 2: ('passphrase_protection', p.BoolType, 0), 3: ('pin_protection', p.BoolType, 0), - 4: ('language', p.UnicodeType, 0), # default=english + 4: ('language', p.UnicodeType, 0), # default=en-US 5: ('label', p.UnicodeType, 0), 6: ('enforce_wordlist', p.BoolType, 0), 8: ('type', p.EnumType("RecoveryDeviceType", (0, 1)), 0), diff --git a/python/src/trezorlib/messages/ResetDevice.py b/python/src/trezorlib/messages/ResetDevice.py index e4b588c6d..123f55a31 100644 --- a/python/src/trezorlib/messages/ResetDevice.py +++ b/python/src/trezorlib/messages/ResetDevice.py @@ -45,7 +45,7 @@ class ResetDevice(p.MessageType): 2: ('strength', p.UVarintType, 0), # default=256 3: ('passphrase_protection', p.BoolType, 0), 4: ('pin_protection', p.BoolType, 0), - 5: ('language', p.UnicodeType, 0), # default=english + 5: ('language', p.UnicodeType, 0), # default=en-US 6: ('label', p.UnicodeType, 0), 7: ('u2f_counter', p.UVarintType, 0), 8: ('skip_backup', p.BoolType, 0), diff --git a/tests/conftest.py b/tests/conftest.py index 49fea36bf..ed13e96c0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -116,7 +116,7 @@ def client(request): pin=setup_params["pin"], passphrase_protection=setup_params["passphrase"], label="test", - language="english", + language="en-US", needs_backup=setup_params["needs_backup"], no_backup=setup_params["no_backup"], ) diff --git a/tests/device_tests/test_msg_applysettings.py b/tests/device_tests/test_msg_applysettings.py index 7acee541a..c9f83063a 100644 --- a/tests/device_tests/test_msg_applysettings.py +++ b/tests/device_tests/test_msg_applysettings.py @@ -44,13 +44,13 @@ class TestMsgApplysettings: @pytest.mark.skip_t2 def test_invalid_language(self, client): - assert client.features.language == "english" + assert client.features.language == "en-US" with client: _set_expected_responses(client) device.apply_settings(client, language="nonexistent") - assert client.features.language == "english" + assert client.features.language == "en-US" @pytest.mark.setup_client(pin=True, passphrase=False) def test_apply_settings_passphrase(self, client): diff --git a/tests/device_tests/test_msg_backup_device.py b/tests/device_tests/test_msg_backup_device.py index c0138c4cf..f605b9ff4 100644 --- a/tests/device_tests/test_msg_backup_device.py +++ b/tests/device_tests/test_msg_backup_device.py @@ -306,6 +306,6 @@ def test_no_backup_show_entropy_fails(client): passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", no_backup=True, ) diff --git a/tests/device_tests/test_msg_cardano_get_address.py b/tests/device_tests/test_msg_cardano_get_address.py index d7429e121..22cefe115 100644 --- a/tests/device_tests/test_msg_cardano_get_address.py +++ b/tests/device_tests/test_msg_cardano_get_address.py @@ -44,7 +44,6 @@ from ..common import MNEMONIC12 ) @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_cardano_get_address(client, path, expected_address): - # data from https://iancoleman.io/bip39/#english - + # data from https://iancoleman.io/bip39/ address = get_address(client, parse_path(path)) assert address == expected_address diff --git a/tests/device_tests/test_msg_loaddevice.py b/tests/device_tests/test_msg_loaddevice.py index 388f436a2..e308a4216 100644 --- a/tests/device_tests/test_msg_loaddevice.py +++ b/tests/device_tests/test_msg_loaddevice.py @@ -115,7 +115,7 @@ class TestDeviceLoad: pin="", passphrase_protection=True, label="test", - language="english", + language="en-US", skip_checksum=True, ) if client.features.model == "T": @@ -130,7 +130,7 @@ class TestDeviceLoad: pin="", passphrase_protection=True, label="test", - language="english", + language="en-US", skip_checksum=True, ) if client.features.model == "T": @@ -145,7 +145,7 @@ class TestDeviceLoad: pin="", passphrase_protection=True, label="test", - language="english", + language="en-US", skip_checksum=True, ) if client.features.model == "T": @@ -160,7 +160,7 @@ class TestDeviceLoad: pin="", passphrase_protection=True, label="test", - language="english", + language="en-US", skip_checksum=True, ) if client.features.model == "T": diff --git a/tests/device_tests/test_msg_recoverydevice_bip39.py b/tests/device_tests/test_msg_recoverydevice_bip39.py index 6861c5700..69e78f137 100644 --- a/tests/device_tests/test_msg_recoverydevice_bip39.py +++ b/tests/device_tests/test_msg_recoverydevice_bip39.py @@ -35,7 +35,7 @@ class TestMsgRecoverydevice: passphrase_protection=True, pin_protection=True, label="label", - language="english", + language="en-US", enforce_wordlist=True, ) ) @@ -98,7 +98,7 @@ class TestMsgRecoverydevice: passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", enforce_wordlist=True, ) ) @@ -152,7 +152,7 @@ class TestMsgRecoverydevice: passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", enforce_wordlist=True, ) ) @@ -180,7 +180,7 @@ class TestMsgRecoverydevice: passphrase_protection=True, pin_protection=True, label="label", - language="english", + language="en-US", enforce_wordlist=True, ) ) @@ -207,5 +207,5 @@ class TestMsgRecoverydevice: def test_already_initialized(self, client): with pytest.raises(RuntimeError): device.recover( - client, 12, False, False, "label", "english", client.mnemonic_callback + client, 12, False, False, "label", "en-US", client.mnemonic_callback ) diff --git a/tests/device_tests/test_msg_recoverydevice_bip39_t2.py b/tests/device_tests/test_msg_recoverydevice_bip39_t2.py index d734f7ec4..79d516e21 100644 --- a/tests/device_tests/test_msg_recoverydevice_bip39_t2.py +++ b/tests/device_tests/test_msg_recoverydevice_bip39_t2.py @@ -149,5 +149,5 @@ class TestMsgRecoverydeviceT2: def test_already_initialized(self, client): with pytest.raises(RuntimeError): device.recover( - client, 12, False, False, "label", "english", client.mnemonic_callback + client, 12, False, False, "label", "en-US", client.mnemonic_callback ) diff --git a/tests/device_tests/test_msg_recoverydevice_slip39_advanced_dryrun.py b/tests/device_tests/test_msg_recoverydevice_slip39_advanced_dryrun.py index 29d62e6d9..f170002d8 100644 --- a/tests/device_tests/test_msg_recoverydevice_slip39_advanced_dryrun.py +++ b/tests/device_tests/test_msg_recoverydevice_slip39_advanced_dryrun.py @@ -55,7 +55,7 @@ def test_2of3_dryrun(client): passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", dry_run=True, ) @@ -87,6 +87,6 @@ def test_2of3_invalid_seed_dryrun(client): passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", dry_run=True, ) diff --git a/tests/device_tests/test_msg_recoverydevice_slip39_basic_dryrun.py b/tests/device_tests/test_msg_recoverydevice_slip39_basic_dryrun.py index 0a8b3564f..e2238116d 100644 --- a/tests/device_tests/test_msg_recoverydevice_slip39_basic_dryrun.py +++ b/tests/device_tests/test_msg_recoverydevice_slip39_basic_dryrun.py @@ -52,7 +52,7 @@ def test_2of3_dryrun(client): passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", dry_run=True, ) @@ -82,6 +82,6 @@ def test_2of3_invalid_seed_dryrun(client): passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", dry_run=True, ) diff --git a/tests/device_tests/test_msg_resetdevice_bip39.py b/tests/device_tests/test_msg_resetdevice_bip39.py index 7cba9cdb0..4606efed9 100644 --- a/tests/device_tests/test_msg_resetdevice_bip39.py +++ b/tests/device_tests/test_msg_resetdevice_bip39.py @@ -36,7 +36,7 @@ class TestMsgResetDevice: strength=strength, passphrase_protection=False, pin_protection=False, - language="english", + language="en-US", label="test", ) ) @@ -106,7 +106,7 @@ class TestMsgResetDevice: strength=strength, passphrase_protection=True, pin_protection=True, - language="english", + language="en-US", label="test", ) ) @@ -195,7 +195,7 @@ class TestMsgResetDevice: strength=strength, passphrase_protection=True, pin_protection=True, - language="english", + language="en-US", label="test", ) ) @@ -230,4 +230,4 @@ class TestMsgResetDevice: def test_already_initialized(self, client): with pytest.raises(Exception): - device.reset(client, False, 128, True, True, "label", "english") + device.reset(client, False, 128, True, True, "label", "en-US") diff --git a/tests/device_tests/test_msg_resetdevice_bip39_skipbackup.py b/tests/device_tests/test_msg_resetdevice_bip39_skipbackup.py index a50455d2c..366a4247e 100644 --- a/tests/device_tests/test_msg_resetdevice_bip39_skipbackup.py +++ b/tests/device_tests/test_msg_resetdevice_bip39_skipbackup.py @@ -36,7 +36,7 @@ class TestMsgResetDeviceSkipbackup: strength=self.strength, passphrase_protection=False, pin_protection=False, - language="english", + language="en-US", label="test", skip_backup=True, ) @@ -106,7 +106,7 @@ class TestMsgResetDeviceSkipbackup: strength=self.strength, passphrase_protection=False, pin_protection=False, - language="english", + language="en-US", label="test", skip_backup=True, ) @@ -163,7 +163,7 @@ class TestMsgResetDeviceSkipbackup: strength=self.strength, passphrase_protection=False, pin_protection=False, - language="english", + language="en-US", label="test", skip_backup=True, ) diff --git a/tests/device_tests/test_msg_resetdevice_bip39_t2.py b/tests/device_tests/test_msg_resetdevice_bip39_t2.py index 11371fb61..f44853de8 100644 --- a/tests/device_tests/test_msg_resetdevice_bip39_t2.py +++ b/tests/device_tests/test_msg_resetdevice_bip39_t2.py @@ -87,7 +87,7 @@ class TestMsgResetDeviceT2: passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", ) # generate mnemonic locally @@ -189,7 +189,7 @@ class TestMsgResetDeviceT2: passphrase_protection=True, pin_protection=True, label="test", - language="english", + language="en-US", ) # generate mnemonic locally @@ -235,4 +235,4 @@ class TestMsgResetDeviceT2: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_already_initialized(self, client): with pytest.raises(Exception): - device.reset(client, False, 128, True, True, "label", "english") + device.reset(client, False, 128, True, True, "label", "en-US") diff --git a/tests/device_tests/test_msg_resetdevice_slip39_advanced.py b/tests/device_tests/test_msg_resetdevice_slip39_advanced.py index f8ae17bd2..a36ab725e 100644 --- a/tests/device_tests/test_msg_resetdevice_slip39_advanced.py +++ b/tests/device_tests/test_msg_resetdevice_slip39_advanced.py @@ -159,7 +159,7 @@ class TestMsgResetDeviceT2: passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", backup_type=BackupType.Slip39_Advanced, ) diff --git a/tests/device_tests/test_msg_resetdevice_slip39_basic.py b/tests/device_tests/test_msg_resetdevice_slip39_basic.py index 94f24b508..bb018d98d 100644 --- a/tests/device_tests/test_msg_resetdevice_slip39_basic.py +++ b/tests/device_tests/test_msg_resetdevice_slip39_basic.py @@ -106,7 +106,7 @@ class TestMsgResetDeviceT2: passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", backup_type=BackupType.Slip39_Basic, ) diff --git a/tests/device_tests/test_msg_ripple_get_address.py b/tests/device_tests/test_msg_ripple_get_address.py index 0cb8617a9..dd5f97077 100644 --- a/tests/device_tests/test_msg_ripple_get_address.py +++ b/tests/device_tests/test_msg_ripple_get_address.py @@ -31,7 +31,7 @@ CUSTOM_MNEMONIC = ( @pytest.mark.skip_t1 # T1 support is not planned class TestMsgRippleGetAddress: def test_ripple_get_address(self, client): - # data from https://iancoleman.io/bip39/#english + # data from https://iancoleman.io/bip39/ address = get_address(client, parse_path("m/44'/144'/0'/0/0")) assert address == "rNaqKtKrMSwpwZSzRckPf7S96DkimjkF4H" address = get_address(client, parse_path("m/44'/144'/0'/0/1")) diff --git a/tests/device_tests/test_protection_levels.py b/tests/device_tests/test_protection_levels.py index 9dd4946d7..67004270f 100644 --- a/tests/device_tests/test_protection_levels.py +++ b/tests/device_tests/test_protection_levels.py @@ -115,7 +115,7 @@ class TestProtectionLevels: + [proto.ButtonRequest()] * 24 + [proto.Success(), proto.Features()] ) - device.reset(client, False, 128, True, False, "label", "english") + device.reset(client, False, 128, True, False, "label", "en-US") with pytest.raises(TrezorFailure): # This must fail, because device is already initialized @@ -127,7 +127,7 @@ class TestProtectionLevels: passphrase_protection=True, pin_protection=False, label="label", - language="english", + language="en-US", ) ) @@ -142,7 +142,7 @@ class TestProtectionLevels: ) device.recover( - client, 12, False, False, "label", "english", client.mnemonic_callback + client, 12, False, False, "label", "en-US", client.mnemonic_callback ) with pytest.raises(TrezorFailure): @@ -154,7 +154,7 @@ class TestProtectionLevels: passphrase_protection=False, pin_protection=False, label="label", - language="english", + language="en-US", ) ) diff --git a/tests/device_tests/test_reset_recovery_bip39.py b/tests/device_tests/test_reset_recovery_bip39.py index 2b50d8cf5..6bd7f7199 100644 --- a/tests/device_tests/test_reset_recovery_bip39.py +++ b/tests/device_tests/test_reset_recovery_bip39.py @@ -87,7 +87,7 @@ def reset(client, strength=128, skip_backup=False): passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", backup_type=BackupType.Bip39, ) diff --git a/tests/device_tests/test_reset_recovery_slip39_advanced.py b/tests/device_tests/test_reset_recovery_slip39_advanced.py index cdf2c745e..eaee4e5ba 100644 --- a/tests/device_tests/test_reset_recovery_slip39_advanced.py +++ b/tests/device_tests/test_reset_recovery_slip39_advanced.py @@ -176,7 +176,7 @@ def reset(client, strength=128): passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", backup_type=BackupType.Slip39_Advanced, ) diff --git a/tests/device_tests/test_reset_recovery_slip39_basic.py b/tests/device_tests/test_reset_recovery_slip39_basic.py index 9bc3151c1..43b40d487 100644 --- a/tests/device_tests/test_reset_recovery_slip39_basic.py +++ b/tests/device_tests/test_reset_recovery_slip39_basic.py @@ -111,7 +111,7 @@ def reset(client, strength=128): passphrase_protection=False, pin_protection=False, label="test", - language="english", + language="en-US", backup_type=BackupType.Slip39_Basic, ) diff --git a/tests/upgrade_tests/test_firmware_upgrades.py b/tests/upgrade_tests/test_firmware_upgrades.py index 3504a9606..ff7ede598 100644 --- a/tests/upgrade_tests/test_firmware_upgrades.py +++ b/tests/upgrade_tests/test_firmware_upgrades.py @@ -36,7 +36,7 @@ MNEMONIC = " ".join(["all"] * 12) PATH = [H_(44), H_(0), H_(0), 0, 0] ADDRESS = "1JAd7XCBzGudGpJQSDSfpmJhiygtLQWaGL" LABEL = "test" -LANGUAGE = "english" +LANGUAGE = "en-US" STRENGTH = 128 @@ -83,7 +83,6 @@ def test_upgrade_load(gen, from_tag, to_tag): assert not client.features.passphrase_protection assert client.features.initialized assert client.features.label == LABEL - assert client.features.language == LANGUAGE assert btc.get_address(client, "Bitcoin", PATH) == ADDRESS with EmulatorWrapper(gen, from_tag) as emu: @@ -102,6 +101,7 @@ def test_upgrade_load(gen, from_tag, to_tag): with EmulatorWrapper(gen, to_tag, storage=storage) as emu: assert device_id == emu.client.features.device_id asserts(to_tag, emu.client) + assert emu.client.features.language == LANGUAGE @for_all("legacy") @@ -111,7 +111,6 @@ def test_upgrade_reset(gen, from_tag, to_tag): assert not client.features.passphrase_protection assert client.features.initialized assert client.features.label == LABEL - assert client.features.language == LANGUAGE assert not client.features.needs_backup assert not client.features.unfinished_backup assert not client.features.no_backup @@ -134,6 +133,7 @@ def test_upgrade_reset(gen, from_tag, to_tag): with EmulatorWrapper(gen, to_tag, storage=storage) as emu: assert device_id == emu.client.features.device_id asserts(to_tag, emu.client) + assert emu.client.features.language == LANGUAGE assert btc.get_address(emu.client, "Bitcoin", PATH) == address @@ -144,7 +144,6 @@ def test_upgrade_reset_skip_backup(gen, from_tag, to_tag): assert not client.features.passphrase_protection assert client.features.initialized assert client.features.label == LABEL - assert client.features.language == LANGUAGE assert client.features.needs_backup assert not client.features.unfinished_backup assert not client.features.no_backup @@ -168,6 +167,7 @@ def test_upgrade_reset_skip_backup(gen, from_tag, to_tag): with EmulatorWrapper(gen, to_tag, storage=storage) as emu: assert device_id == emu.client.features.device_id asserts(to_tag, emu.client) + assert emu.client.features.language == LANGUAGE assert btc.get_address(emu.client, "Bitcoin", PATH) == address @@ -178,7 +178,6 @@ def test_upgrade_reset_no_backup(gen, from_tag, to_tag): assert not client.features.passphrase_protection assert client.features.initialized assert client.features.label == LABEL - assert client.features.language == LANGUAGE assert not client.features.needs_backup assert not client.features.unfinished_backup assert client.features.no_backup @@ -202,6 +201,7 @@ def test_upgrade_reset_no_backup(gen, from_tag, to_tag): with EmulatorWrapper(gen, to_tag, storage=storage) as emu: assert device_id == emu.client.features.device_id asserts(to_tag, emu.client) + assert emu.client.features.language == LANGUAGE assert btc.get_address(emu.client, "Bitcoin", PATH) == address diff --git a/vendor/fido2-tests b/vendor/fido2-tests index 67f0023be..f81bb68da 160000 --- a/vendor/fido2-tests +++ b/vendor/fido2-tests @@ -1 +1 @@ -Subproject commit 67f0023be4913a86f62bedf700f86ca3079cf842 +Subproject commit f81bb68dabf90d76ebe57e665363370bf56b77f9