mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix tests
This commit is contained in:
parent
864a186862
commit
b9189b1979
3 changed files with 14 additions and 10 deletions
|
@ -600,7 +600,6 @@
|
|||
"user_unknown": "Unknown user: {user:s}",
|
||||
"user_update_failed": "Could not update user {user}: {error}",
|
||||
"user_updated": "User info changed",
|
||||
"users_available": "Available users:",
|
||||
"yunohost_already_installed": "YunoHost is already installed",
|
||||
"yunohost_ca_creation_failed": "Could not create certificate authority",
|
||||
"yunohost_ca_creation_success": "Local certification authority created.",
|
||||
|
|
|
@ -2715,6 +2715,7 @@ class AppArgumentParser(YunoHostArgumentFormatParser):
|
|||
|
||||
|
||||
class DisplayTextArgumentParser(YunoHostArgumentFormatParser):
|
||||
argument_type = "display_text"
|
||||
|
||||
def parse(self, question, user_answers):
|
||||
print(question["ask"])
|
||||
|
|
|
@ -883,7 +883,8 @@ def test_parse_args_in_yunohost_format_user():
|
|||
expected_result = OrderedDict({"some_user": (username, "user")})
|
||||
|
||||
with patch.object(user, "user_list", return_value={"users": users}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
with patch.object(user, "user_info", return_value={}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users():
|
||||
|
@ -913,13 +914,15 @@ def test_parse_args_in_yunohost_format_user_two_users():
|
|||
expected_result = OrderedDict({"some_user": (other_user, "user")})
|
||||
|
||||
with patch.object(user, "user_list", return_value={"users": users}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
with patch.object(user, "user_info", return_value={}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
answers = {"some_user": username}
|
||||
expected_result = OrderedDict({"some_user": (username, "user")})
|
||||
|
||||
with patch.object(user, "user_list", return_value={"users": users}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
with patch.object(user, "user_info", return_value={}):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_user_two_users_wrong_answer():
|
||||
|
@ -1008,13 +1011,14 @@ def test_parse_args_in_yunohost_format_user_two_users_default_input():
|
|||
answers = {}
|
||||
|
||||
with patch.object(user, "user_list", return_value={"users": users}):
|
||||
expected_result = OrderedDict({"some_user": (username, "user")})
|
||||
with patch.object(msignals, "prompt", return_value=username):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
with patch.object(user, "user_info", return_value={}):
|
||||
expected_result = OrderedDict({"some_user": (username, "user")})
|
||||
with patch.object(msignals, "prompt", return_value=username):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
expected_result = OrderedDict({"some_user": (other_user, "user")})
|
||||
with patch.object(msignals, "prompt", return_value=other_user):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
expected_result = OrderedDict({"some_user": (other_user, "user")})
|
||||
with patch.object(msignals, "prompt", return_value=other_user):
|
||||
assert _parse_args_in_yunohost_format(answers, questions) == expected_result
|
||||
|
||||
|
||||
def test_parse_args_in_yunohost_format_app_empty():
|
||||
|
|
Loading…
Add table
Reference in a new issue