Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for failing tests on CI with no locale set #1311

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/cli/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ def test_list_vehicles_prompt(
)
assert result.exit_code == 0, result.exception

default_locale = getdefaultlocale()[0]
prompt_default = f" [{default_locale}]" if default_locale else ""

expected_output = (
f"Please select a locale [{getdefaultlocale()[0]}]: {TEST_LOCALE}\n"
f"Please select a locale{prompt_default}: {TEST_LOCALE}\n"
"Do you want to save the locale to the credential store? [y/N]: N\n"
"\n"
f"User: {TEST_USERNAME}\n"
Expand Down
9 changes: 7 additions & 2 deletions tests/cli/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def test_login_prompt(mocked_responses: aioresponses, cli_runner: CliRunner) ->
input=f"{TEST_USERNAME}\n{TEST_PASSWORD}\n{TEST_LOCALE}\ny",
)
assert result.exit_code == 0, result.exception
default_locale = getdefaultlocale()[0]
prompt_default = f" [{default_locale}]" if default_locale else ""

expected_output = (
f"User: {TEST_USERNAME}\n"
"Password: \n"
f"Please select a locale [{getdefaultlocale()[0]}]: {TEST_LOCALE}\n"
f"Please select a locale{prompt_default}: {TEST_LOCALE}\n"
"Do you want to save the locale to the credential store? [y/N]: y\n"
"\n"
)
Expand Down Expand Up @@ -70,9 +73,11 @@ def test_list_accounts_prompt(
input=f"{TEST_LOCALE}\nN\n{TEST_USERNAME}\n{TEST_PASSWORD}\n",
)
assert result.exit_code == 0, result.exception
default_locale = getdefaultlocale()[0]
prompt_default = f" [{default_locale}]" if default_locale else ""

expected_output = (
f"Please select a locale [{getdefaultlocale()[0]}]: {TEST_LOCALE}\n"
f"Please select a locale{prompt_default}: {TEST_LOCALE}\n"
"Do you want to save the locale to the credential store? [y/N]: N\n"
"\n"
f"User: {TEST_USERNAME}\n"
Expand Down
5 changes: 4 additions & 1 deletion tests/cli/test_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ def test_vehicle_status_prompt(
)
assert result.exit_code == 0, result.exception

default_locale = getdefaultlocale()[0]
prompt_default = f" [{default_locale}]" if default_locale else ""

expected_output = (
f"Please select a locale [{getdefaultlocale()[0]}]: {TEST_LOCALE}\n"
f"Please select a locale{prompt_default}: {TEST_LOCALE}\n"
"Do you want to save the locale to the credential store? [y/N]: N\n"
"\n"
f"User: {TEST_USERNAME}\n"
Expand Down
Loading