Skip to content

Commit

Permalink
Fix locale tests, now using pt-BR
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeubas committed Aug 29, 2023
1 parent 680b96a commit a3b2be1
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/pages/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,15 +1619,15 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
from krux.themes import WHITE, RED, GREEN, ORANGE, MAGENTA

tlist = list(translation_table)
index_en = tlist.index("en-US")
index_next = (index_en + 1) % (len(tlist))
text_en = translation_table[tlist[index_en]][1177338798] + "\n" + tlist[index_en]
index_pt = tlist.index("pt-BR")
index_next = (index_pt + 1) % (len(tlist))
text_pt = translation_table[tlist[index_pt]][1177338798] + "\n" + tlist[index_pt]
text_next = (
translation_table[tlist[index_next]][1177338798] + "\n" + tlist[index_next]
)

cases = [
(
( # 0
(
# Bitcoin
BUTTON_ENTER,
Expand All @@ -1645,7 +1645,7 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
lambda: Settings().bitcoin.network == "test",
CategorySetting,
),
(
( # 1
(
# Printer
BUTTON_PAGE,
Expand Down Expand Up @@ -1680,7 +1680,7 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
lambda: Settings().printer.thermal.adafruit.baudrate == 19200,
CategorySetting,
),
(
( # 2
(
# Language
BUTTON_PAGE,
Expand All @@ -1691,13 +1691,13 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
BUTTON_ENTER,
),
[
mocker.call(text_en, WHITE),
mocker.call(text_pt, WHITE),
mocker.call(text_next, WHITE),
],
lambda: Settings().i18n.locale == tlist[index_next],
CategorySetting,
),
(
( # 3
(
# Logging
BUTTON_PAGE,
Expand Down Expand Up @@ -1727,7 +1727,7 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
lambda: Settings().logging.level == "DEBUG",
CategorySetting,
),
(
( # 4
(
# Printer
BUTTON_PAGE,
Expand Down Expand Up @@ -1789,7 +1789,7 @@ def test_settings_m5stickv(m5stickv, mocker, mocker_printer):
ctx = create_ctx(mocker, case[0])
login = Login(ctx)

Settings().i18n.locale = "en-US"
Settings().i18n.locale = "pt-BR"
login.settings()

assert ctx.input.wait_for_button.call_count == len(case[0])
Expand All @@ -1806,9 +1806,9 @@ def test_settings_on_amigo_tft(amigo_tft, mocker, mocker_printer):
from krux.themes import WHITE, RED, GREEN, ORANGE, MAGENTA

tlist = list(translation_table)
index_en = tlist.index("en-US")
index_next = (index_en + 1) % (len(tlist))
text_en = translation_table[tlist[index_en]][1177338798] + "\n" + tlist[index_en]
index_pt = tlist.index("pt-BR")
index_next = (index_pt + 1) % (len(tlist))
text_pt = translation_table[tlist[index_pt]][1177338798] + "\n" + tlist[index_pt]
text_next = (
translation_table[tlist[index_next]][1177338798] + "\n" + tlist[index_next]
)
Expand Down Expand Up @@ -1873,7 +1873,7 @@ def test_settings_on_amigo_tft(amigo_tft, mocker, mocker_printer):
GO_INDEX,
),
[
mocker.call(text_en, WHITE),
mocker.call(text_pt, WHITE),
mocker.call(text_next, WHITE),
],
lambda: Settings().i18n.locale == tlist[index_next],
Expand Down Expand Up @@ -1920,7 +1920,7 @@ def test_settings_on_amigo_tft(amigo_tft, mocker, mocker_printer):

login = Login(ctx)

Settings().i18n.locale = "en-US"
Settings().i18n.locale = "pt-BR"
login.settings()

assert ctx.input.wait_for_button.call_count == len(case[0])
Expand Down

0 comments on commit a3b2be1

Please sign in to comment.