mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge branch 'enh-config-panel-file' of github.com:YunoHost/yunohost into enh-config-panel-file
This commit is contained in:
commit
6276385120
5 changed files with 106 additions and 106 deletions
|
@ -112,11 +112,11 @@ test-appurl:
|
|||
changes:
|
||||
- src/yunohost/app.py
|
||||
|
||||
test-config:
|
||||
test-questions:
|
||||
extends: .test-stage
|
||||
script:
|
||||
- cd src/yunohost
|
||||
- python3 -m pytest tests/test_config.py
|
||||
- python3 -m pytest tests/test_questions.py
|
||||
only:
|
||||
changes:
|
||||
- src/yunohost/utils/config.py
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"app_already_installed_cant_change_url": "This app is already installed. The URL cannot be changed just by this function. Check in `app changeurl` if it's available.",
|
||||
"app_already_up_to_date": "{app} is already up-to-date",
|
||||
"app_argument_choice_invalid": "Use one of these choices '{choices}' for the argument '{name}' instead of '{value}'",
|
||||
"app_argument_invalid": "Pick a valid value for the argument '{field}': {error}",
|
||||
"app_argument_invalid": "Pick a valid value for the argument '{name}': {error}",
|
||||
"app_argument_password_no_default": "Error while parsing password argument '{name}': password argument can't have a default value for security reason",
|
||||
"app_argument_required": "Argument '{name}' is required",
|
||||
"app_change_url_failed_nginx_reload": "Could not reload NGINX. Here is the output of 'nginx -t':\n{nginx_errors}",
|
||||
|
|
|
@ -286,9 +286,9 @@ def service_reload_or_restart(names, test_conf=True):
|
|||
|
||||
out, _ = p.communicate()
|
||||
if p.returncode != 0:
|
||||
errors = out.strip().split("\n")
|
||||
errors = out.decode().strip().split("\n")
|
||||
logger.error(
|
||||
m18n.n("service_not_reloading_because_conf_broken", errors=errors)
|
||||
m18n.n("service_not_reloading_because_conf_broken", name=name, errors=errors)
|
||||
)
|
||||
continue
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ User answers:
|
|||
"""
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_empty():
|
||||
def test_question_empty():
|
||||
assert parse_args_in_yunohost_format({}, []) == {}
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string():
|
||||
def test_question_string():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -51,7 +51,7 @@ def test_parse_args_in_yunohost_format_string():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_default_type():
|
||||
def test_question_string_default_type():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -62,7 +62,7 @@ def test_parse_args_in_yunohost_format_string_default_type():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_no_input():
|
||||
def test_question_string_no_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -74,7 +74,7 @@ def test_parse_args_in_yunohost_format_string_no_input():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_input():
|
||||
def test_question_string_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -88,7 +88,7 @@ def test_parse_args_in_yunohost_format_string_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_input_no_ask():
|
||||
def test_question_string_input_no_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -101,7 +101,7 @@ def test_parse_args_in_yunohost_format_string_input_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_no_input_optional():
|
||||
def test_question_string_no_input_optional():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -113,7 +113,7 @@ def test_parse_args_in_yunohost_format_string_no_input_optional():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_optional_with_input():
|
||||
def test_question_string_optional_with_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -128,7 +128,7 @@ def test_parse_args_in_yunohost_format_string_optional_with_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_optional_with_empty_input():
|
||||
def test_question_string_optional_with_empty_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -143,7 +143,7 @@ def test_parse_args_in_yunohost_format_string_optional_with_empty_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_optional_with_input_without_ask():
|
||||
def test_question_string_optional_with_input_without_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -157,7 +157,7 @@ def test_parse_args_in_yunohost_format_string_optional_with_input_without_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_no_input_default():
|
||||
def test_question_string_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -170,7 +170,7 @@ def test_parse_args_in_yunohost_format_string_no_input_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_input_test_ask():
|
||||
def test_question_string_input_test_ask():
|
||||
ask_text = "some question"
|
||||
questions = [
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ def test_parse_args_in_yunohost_format_string_input_test_ask():
|
|||
prompt.assert_called_with(ask_text, False)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_input_test_ask_with_default():
|
||||
def test_question_string_input_test_ask_with_default():
|
||||
ask_text = "some question"
|
||||
default_text = "some example"
|
||||
questions = [
|
||||
|
@ -207,7 +207,7 @@ def test_parse_args_in_yunohost_format_string_input_test_ask_with_default():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this example
|
||||
def test_parse_args_in_yunohost_format_string_input_test_ask_with_example():
|
||||
def test_question_string_input_test_ask_with_example():
|
||||
ask_text = "some question"
|
||||
example_text = "some example"
|
||||
questions = [
|
||||
|
@ -228,7 +228,7 @@ def test_parse_args_in_yunohost_format_string_input_test_ask_with_example():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this help
|
||||
def test_parse_args_in_yunohost_format_string_input_test_ask_with_help():
|
||||
def test_question_string_input_test_ask_with_help():
|
||||
ask_text = "some question"
|
||||
help_text = "some_help"
|
||||
questions = [
|
||||
|
@ -248,14 +248,14 @@ def test_parse_args_in_yunohost_format_string_input_test_ask_with_help():
|
|||
assert help_text in prompt.call_args[0][0]
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_with_choice():
|
||||
def test_question_string_with_choice():
|
||||
questions = [{"name": "some_string", "type": "string", "choices": ["fr", "en"]}]
|
||||
answers = {"some_string": "fr"}
|
||||
expected_result = OrderedDict({"some_string": ("fr", "string")})
|
||||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_with_choice_prompt():
|
||||
def test_question_string_with_choice_prompt():
|
||||
questions = [{"name": "some_string", "type": "string", "choices": ["fr", "en"]}]
|
||||
answers = {"some_string": "fr"}
|
||||
expected_result = OrderedDict({"some_string": ("fr", "string")})
|
||||
|
@ -263,7 +263,7 @@ def test_parse_args_in_yunohost_format_string_with_choice_prompt():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_with_choice_bad():
|
||||
def test_question_string_with_choice_bad():
|
||||
questions = [{"name": "some_string", "type": "string", "choices": ["fr", "en"]}]
|
||||
answers = {"some_string": "bad"}
|
||||
|
||||
|
@ -271,7 +271,7 @@ def test_parse_args_in_yunohost_format_string_with_choice_bad():
|
|||
assert parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_with_choice_ask():
|
||||
def test_question_string_with_choice_ask():
|
||||
ask_text = "some question"
|
||||
choices = ["fr", "en", "es", "it", "ru"]
|
||||
questions = [
|
||||
|
@ -291,7 +291,7 @@ def test_parse_args_in_yunohost_format_string_with_choice_ask():
|
|||
assert choice in prompt.call_args[0][0]
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_string_with_choice_default():
|
||||
def test_question_string_with_choice_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_string",
|
||||
|
@ -305,7 +305,7 @@ def test_parse_args_in_yunohost_format_string_with_choice_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password():
|
||||
def test_question_password():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -317,7 +317,7 @@ def test_parse_args_in_yunohost_format_password():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_no_input():
|
||||
def test_question_password_no_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -330,7 +330,7 @@ def test_parse_args_in_yunohost_format_password_no_input():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_input():
|
||||
def test_question_password_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -345,7 +345,7 @@ def test_parse_args_in_yunohost_format_password_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_input_no_ask():
|
||||
def test_question_password_input_no_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -359,7 +359,7 @@ def test_parse_args_in_yunohost_format_password_input_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_no_input_optional():
|
||||
def test_question_password_no_input_optional():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -379,7 +379,7 @@ def test_parse_args_in_yunohost_format_password_no_input_optional():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_optional_with_input():
|
||||
def test_question_password_optional_with_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -395,7 +395,7 @@ def test_parse_args_in_yunohost_format_password_optional_with_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_optional_with_empty_input():
|
||||
def test_question_password_optional_with_empty_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -411,7 +411,7 @@ def test_parse_args_in_yunohost_format_password_optional_with_empty_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_optional_with_input_without_ask():
|
||||
def test_question_password_optional_with_input_without_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -426,7 +426,7 @@ def test_parse_args_in_yunohost_format_password_optional_with_input_without_ask(
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_no_input_default():
|
||||
def test_question_password_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -443,7 +443,7 @@ def test_parse_args_in_yunohost_format_password_no_input_default():
|
|||
|
||||
|
||||
@pytest.mark.skip # this should raises
|
||||
def test_parse_args_in_yunohost_format_password_no_input_example():
|
||||
def test_question_password_no_input_example():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -459,7 +459,7 @@ def test_parse_args_in_yunohost_format_password_no_input_example():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_input_test_ask():
|
||||
def test_question_password_input_test_ask():
|
||||
ask_text = "some question"
|
||||
questions = [
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ def test_parse_args_in_yunohost_format_password_input_test_ask():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this example
|
||||
def test_parse_args_in_yunohost_format_password_input_test_ask_with_example():
|
||||
def test_question_password_input_test_ask_with_example():
|
||||
ask_text = "some question"
|
||||
example_text = "some example"
|
||||
questions = [
|
||||
|
@ -500,7 +500,7 @@ def test_parse_args_in_yunohost_format_password_input_test_ask_with_example():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this help
|
||||
def test_parse_args_in_yunohost_format_password_input_test_ask_with_help():
|
||||
def test_question_password_input_test_ask_with_help():
|
||||
ask_text = "some question"
|
||||
help_text = "some_help"
|
||||
questions = [
|
||||
|
@ -521,7 +521,7 @@ def test_parse_args_in_yunohost_format_password_input_test_ask_with_help():
|
|||
assert help_text in prompt.call_args[0][0]
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_bad_chars():
|
||||
def test_question_password_bad_chars():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -536,7 +536,7 @@ def test_parse_args_in_yunohost_format_password_bad_chars():
|
|||
parse_args_in_yunohost_format({"some_password": i * 8}, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_strong_enough():
|
||||
def test_question_password_strong_enough():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -554,7 +554,7 @@ def test_parse_args_in_yunohost_format_password_strong_enough():
|
|||
parse_args_in_yunohost_format({"some_password": "password"}, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_password_optional_strong_enough():
|
||||
def test_question_password_optional_strong_enough():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_password",
|
||||
|
@ -572,7 +572,7 @@ def test_parse_args_in_yunohost_format_password_optional_strong_enough():
|
|||
parse_args_in_yunohost_format({"some_password": "password"}, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path():
|
||||
def test_question_path():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -584,7 +584,7 @@ def test_parse_args_in_yunohost_format_path():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_no_input():
|
||||
def test_question_path_no_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -597,7 +597,7 @@ def test_parse_args_in_yunohost_format_path_no_input():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_input():
|
||||
def test_question_path_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -612,7 +612,7 @@ def test_parse_args_in_yunohost_format_path_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_input_no_ask():
|
||||
def test_question_path_input_no_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -626,7 +626,7 @@ def test_parse_args_in_yunohost_format_path_input_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_no_input_optional():
|
||||
def test_question_path_no_input_optional():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -639,7 +639,7 @@ def test_parse_args_in_yunohost_format_path_no_input_optional():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_optional_with_input():
|
||||
def test_question_path_optional_with_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -655,7 +655,7 @@ def test_parse_args_in_yunohost_format_path_optional_with_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_optional_with_empty_input():
|
||||
def test_question_path_optional_with_empty_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -671,7 +671,7 @@ def test_parse_args_in_yunohost_format_path_optional_with_empty_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_optional_with_input_without_ask():
|
||||
def test_question_path_optional_with_input_without_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -686,7 +686,7 @@ def test_parse_args_in_yunohost_format_path_optional_with_input_without_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_no_input_default():
|
||||
def test_question_path_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_path",
|
||||
|
@ -700,7 +700,7 @@ def test_parse_args_in_yunohost_format_path_no_input_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_input_test_ask():
|
||||
def test_question_path_input_test_ask():
|
||||
ask_text = "some question"
|
||||
questions = [
|
||||
{
|
||||
|
@ -718,7 +718,7 @@ def test_parse_args_in_yunohost_format_path_input_test_ask():
|
|||
prompt.assert_called_with(ask_text, False)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_path_input_test_ask_with_default():
|
||||
def test_question_path_input_test_ask_with_default():
|
||||
ask_text = "some question"
|
||||
default_text = "some example"
|
||||
questions = [
|
||||
|
@ -739,7 +739,7 @@ def test_parse_args_in_yunohost_format_path_input_test_ask_with_default():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this example
|
||||
def test_parse_args_in_yunohost_format_path_input_test_ask_with_example():
|
||||
def test_question_path_input_test_ask_with_example():
|
||||
ask_text = "some question"
|
||||
example_text = "some example"
|
||||
questions = [
|
||||
|
@ -761,7 +761,7 @@ def test_parse_args_in_yunohost_format_path_input_test_ask_with_example():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this help
|
||||
def test_parse_args_in_yunohost_format_path_input_test_ask_with_help():
|
||||
def test_question_path_input_test_ask_with_help():
|
||||
ask_text = "some question"
|
||||
help_text = "some_help"
|
||||
questions = [
|
||||
|
@ -782,7 +782,7 @@ def test_parse_args_in_yunohost_format_path_input_test_ask_with_help():
|
|||
assert help_text in prompt.call_args[0][0]
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean():
|
||||
def test_question_boolean():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -794,7 +794,7 @@ def test_parse_args_in_yunohost_format_boolean():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_all_yes():
|
||||
def test_question_boolean_all_yes():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -848,7 +848,7 @@ def test_parse_args_in_yunohost_format_boolean_all_yes():
|
|||
)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_all_no():
|
||||
def test_question_boolean_all_no():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -903,7 +903,7 @@ def test_parse_args_in_yunohost_format_boolean_all_no():
|
|||
|
||||
|
||||
# XXX apparently boolean are always False (0) by default, I'm not sure what to think about that
|
||||
def test_parse_args_in_yunohost_format_boolean_no_input():
|
||||
def test_question_boolean_no_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -916,7 +916,7 @@ def test_parse_args_in_yunohost_format_boolean_no_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_bad_input():
|
||||
def test_question_boolean_bad_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -929,7 +929,7 @@ def test_parse_args_in_yunohost_format_boolean_bad_input():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_input():
|
||||
def test_question_boolean_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -948,7 +948,7 @@ def test_parse_args_in_yunohost_format_boolean_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_input_no_ask():
|
||||
def test_question_boolean_input_no_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -962,7 +962,7 @@ def test_parse_args_in_yunohost_format_boolean_input_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_no_input_optional():
|
||||
def test_question_boolean_no_input_optional():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -975,7 +975,7 @@ def test_parse_args_in_yunohost_format_boolean_no_input_optional():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_optional_with_input():
|
||||
def test_question_boolean_optional_with_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -991,7 +991,7 @@ def test_parse_args_in_yunohost_format_boolean_optional_with_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_optional_with_empty_input():
|
||||
def test_question_boolean_optional_with_empty_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -1007,7 +1007,7 @@ def test_parse_args_in_yunohost_format_boolean_optional_with_empty_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_optional_with_input_without_ask():
|
||||
def test_question_boolean_optional_with_input_without_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -1022,7 +1022,7 @@ def test_parse_args_in_yunohost_format_boolean_optional_with_input_without_ask()
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_no_input_default():
|
||||
def test_question_boolean_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -1036,7 +1036,7 @@ def test_parse_args_in_yunohost_format_boolean_no_input_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_bad_default():
|
||||
def test_question_boolean_bad_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_boolean",
|
||||
|
@ -1050,7 +1050,7 @@ def test_parse_args_in_yunohost_format_boolean_bad_default():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_input_test_ask():
|
||||
def test_question_boolean_input_test_ask():
|
||||
ask_text = "some question"
|
||||
questions = [
|
||||
{
|
||||
|
@ -1066,7 +1066,7 @@ def test_parse_args_in_yunohost_format_boolean_input_test_ask():
|
|||
prompt.assert_called_with(ask_text + " [yes | no] (default: no)", False)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_boolean_input_test_ask_with_default():
|
||||
def test_question_boolean_input_test_ask_with_default():
|
||||
ask_text = "some question"
|
||||
default_text = 1
|
||||
questions = [
|
||||
|
@ -1084,7 +1084,7 @@ def test_parse_args_in_yunohost_format_boolean_input_test_ask_with_default():
|
|||
prompt.assert_called_with("%s [yes | no] (default: yes)" % ask_text, False)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_empty():
|
||||
def test_question_domain_empty():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_domain",
|
||||
|
@ -1101,7 +1101,7 @@ def test_parse_args_in_yunohost_format_domain_empty():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain():
|
||||
def test_question_domain():
|
||||
main_domain = "my_main_domain.com"
|
||||
domains = [main_domain]
|
||||
questions = [
|
||||
|
@ -1120,7 +1120,7 @@ def test_parse_args_in_yunohost_format_domain():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_two_domains():
|
||||
def test_question_domain_two_domains():
|
||||
main_domain = "my_main_domain.com"
|
||||
other_domain = "some_other_domain.tld"
|
||||
domains = [main_domain, other_domain]
|
||||
|
@ -1148,7 +1148,7 @@ def test_parse_args_in_yunohost_format_domain_two_domains():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_two_domains_wrong_answer():
|
||||
def test_question_domain_two_domains_wrong_answer():
|
||||
main_domain = "my_main_domain.com"
|
||||
other_domain = "some_other_domain.tld"
|
||||
domains = [main_domain, other_domain]
|
||||
|
@ -1168,7 +1168,7 @@ def test_parse_args_in_yunohost_format_domain_two_domains_wrong_answer():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_two_domains_default_no_ask():
|
||||
def test_question_domain_two_domains_default_no_ask():
|
||||
main_domain = "my_main_domain.com"
|
||||
other_domain = "some_other_domain.tld"
|
||||
domains = [main_domain, other_domain]
|
||||
|
@ -1188,7 +1188,7 @@ def test_parse_args_in_yunohost_format_domain_two_domains_default_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_two_domains_default():
|
||||
def test_question_domain_two_domains_default():
|
||||
main_domain = "my_main_domain.com"
|
||||
other_domain = "some_other_domain.tld"
|
||||
domains = [main_domain, other_domain]
|
||||
|
@ -1203,7 +1203,7 @@ def test_parse_args_in_yunohost_format_domain_two_domains_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_domain_two_domains_default_input():
|
||||
def test_question_domain_two_domains_default_input():
|
||||
main_domain = "my_main_domain.com"
|
||||
other_domain = "some_other_domain.tld"
|
||||
domains = [main_domain, other_domain]
|
||||
|
@ -1223,7 +1223,7 @@ def test_parse_args_in_yunohost_format_domain_two_domains_default_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_empty():
|
||||
def test_question_user_empty():
|
||||
users = {
|
||||
"some_user": {
|
||||
"ssh_allowed": False,
|
||||
|
@ -1247,7 +1247,7 @@ def test_parse_args_in_yunohost_format_user_empty():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user():
|
||||
def test_question_user():
|
||||
username = "some_user"
|
||||
users = {
|
||||
username: {
|
||||
|
@ -1274,7 +1274,7 @@ def test_parse_args_in_yunohost_format_user():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users():
|
||||
def test_question_user_two_users():
|
||||
username = "some_user"
|
||||
other_user = "some_other_user"
|
||||
users = {
|
||||
|
@ -1315,7 +1315,7 @@ def test_parse_args_in_yunohost_format_user_two_users():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users_wrong_answer():
|
||||
def test_question_user_two_users_wrong_answer():
|
||||
username = "my_username.com"
|
||||
other_user = "some_other_user"
|
||||
users = {
|
||||
|
@ -1348,7 +1348,7 @@ def test_parse_args_in_yunohost_format_user_two_users_wrong_answer():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users_no_default():
|
||||
def test_question_user_two_users_no_default():
|
||||
username = "my_username.com"
|
||||
other_user = "some_other_user.tld"
|
||||
users = {
|
||||
|
@ -1376,7 +1376,7 @@ def test_parse_args_in_yunohost_format_user_two_users_no_default():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users_default_input():
|
||||
def test_question_user_two_users_default_input():
|
||||
username = "my_username.com"
|
||||
other_user = "some_other_user.tld"
|
||||
users = {
|
||||
|
@ -1416,7 +1416,7 @@ def test_parse_args_in_yunohost_format_user_two_users_default_input():
|
|||
)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number():
|
||||
def test_question_number():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1428,7 +1428,7 @@ def test_parse_args_in_yunohost_format_number():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_no_input():
|
||||
def test_question_number_no_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1441,7 +1441,7 @@ def test_parse_args_in_yunohost_format_number_no_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_bad_input():
|
||||
def test_question_number_bad_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1458,7 +1458,7 @@ def test_parse_args_in_yunohost_format_number_bad_input():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_input():
|
||||
def test_question_number_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1480,7 +1480,7 @@ def test_parse_args_in_yunohost_format_number_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_input_no_ask():
|
||||
def test_question_number_input_no_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1494,7 +1494,7 @@ def test_parse_args_in_yunohost_format_number_input_no_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_no_input_optional():
|
||||
def test_question_number_no_input_optional():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1507,7 +1507,7 @@ def test_parse_args_in_yunohost_format_number_no_input_optional():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_optional_with_input():
|
||||
def test_question_number_optional_with_input():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1523,7 +1523,7 @@ def test_parse_args_in_yunohost_format_number_optional_with_input():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_optional_with_input_without_ask():
|
||||
def test_question_number_optional_with_input_without_ask():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1538,7 +1538,7 @@ def test_parse_args_in_yunohost_format_number_optional_with_input_without_ask():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_no_input_default():
|
||||
def test_question_number_no_input_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1552,7 +1552,7 @@ def test_parse_args_in_yunohost_format_number_no_input_default():
|
|||
assert parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_bad_default():
|
||||
def test_question_number_bad_default():
|
||||
questions = [
|
||||
{
|
||||
"name": "some_number",
|
||||
|
@ -1566,7 +1566,7 @@ def test_parse_args_in_yunohost_format_number_bad_default():
|
|||
parse_args_in_yunohost_format(answers, questions)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_input_test_ask():
|
||||
def test_question_number_input_test_ask():
|
||||
ask_text = "some question"
|
||||
questions = [
|
||||
{
|
||||
|
@ -1582,7 +1582,7 @@ def test_parse_args_in_yunohost_format_number_input_test_ask():
|
|||
prompt.assert_called_with("%s (default: 0)" % (ask_text), False)
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_number_input_test_ask_with_default():
|
||||
def test_question_number_input_test_ask_with_default():
|
||||
ask_text = "some question"
|
||||
default_value = 1337
|
||||
questions = [
|
||||
|
@ -1601,7 +1601,7 @@ def test_parse_args_in_yunohost_format_number_input_test_ask_with_default():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this example
|
||||
def test_parse_args_in_yunohost_format_number_input_test_ask_with_example():
|
||||
def test_question_number_input_test_ask_with_example():
|
||||
ask_text = "some question"
|
||||
example_value = 1337
|
||||
questions = [
|
||||
|
@ -1621,7 +1621,7 @@ def test_parse_args_in_yunohost_format_number_input_test_ask_with_example():
|
|||
|
||||
|
||||
@pytest.mark.skip # we should do something with this help
|
||||
def test_parse_args_in_yunohost_format_number_input_test_ask_with_help():
|
||||
def test_question_number_input_test_ask_with_help():
|
||||
ask_text = "some question"
|
||||
help_value = 1337
|
||||
questions = [
|
||||
|
@ -1640,7 +1640,7 @@ def test_parse_args_in_yunohost_format_number_input_test_ask_with_help():
|
|||
assert help_value in prompt.call_args[0][0]
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_display_text():
|
||||
def test_question_display_text():
|
||||
questions = [{"name": "some_app", "type": "display_text", "ask": "foobar"}]
|
||||
answers = {}
|
||||
|
|
@ -110,7 +110,7 @@ class ConfigPanel:
|
|||
if (args is not None or args_file is not None) and value is not None:
|
||||
raise YunohostError("config_args_value")
|
||||
|
||||
if self.filter_key.count(".") != 2 and not value is None:
|
||||
if self.filter_key.count(".") != 2 and value is not None:
|
||||
raise YunohostError("config_set_value_on_section")
|
||||
|
||||
# Import and parse pre-answered options
|
||||
|
@ -676,7 +676,7 @@ class DomainQuestion(Question):
|
|||
|
||||
def _raise_invalid_answer(self):
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid", field=self.name, error=m18n.n("domain_unknown")
|
||||
"app_argument_invalid", name=self.name, error=m18n.n("domain_unknown")
|
||||
)
|
||||
|
||||
|
||||
|
@ -699,7 +699,7 @@ class UserQuestion(Question):
|
|||
def _raise_invalid_answer(self):
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n("user_unknown", user=self.value),
|
||||
)
|
||||
|
||||
|
@ -725,21 +725,21 @@ class NumberQuestion(Question):
|
|||
):
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n("invalid_number"),
|
||||
)
|
||||
|
||||
if self.min is not None and int(self.value) < self.min:
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n("invalid_number"),
|
||||
)
|
||||
|
||||
if self.max is not None and int(self.value) > self.max:
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n("invalid_number"),
|
||||
)
|
||||
|
||||
|
@ -751,7 +751,7 @@ class NumberQuestion(Question):
|
|||
return int(self.value)
|
||||
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid", field=self.name, error=m18n.n("invalid_number")
|
||||
"app_argument_invalid", name=self.name, error=m18n.n("invalid_number")
|
||||
)
|
||||
|
||||
|
||||
|
@ -817,7 +817,7 @@ class FileQuestion(Question):
|
|||
):
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n("file_does_not_exist", path=self.value),
|
||||
)
|
||||
if self.value in [None, ""] or not self.accept:
|
||||
|
@ -827,7 +827,7 @@ class FileQuestion(Question):
|
|||
if "." not in filename or "." + filename.split(".")[-1] not in self.accept:
|
||||
raise YunohostValidationError(
|
||||
"app_argument_invalid",
|
||||
field=self.name,
|
||||
name=self.name,
|
||||
error=m18n.n(
|
||||
"file_extension_not_accepted", file=filename, accept=self.accept
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue