Fix tests

This commit is contained in:
Kay0u 2020-11-25 11:47:57 +01:00
parent f0d3d36365
commit 698d543c56
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -256,9 +256,9 @@ def test_parse_args_in_yunohost_format_password_input_no_ask():
def test_parse_args_in_yunohost_format_password_no_input_optional(): def test_parse_args_in_yunohost_format_password_no_input_optional():
questions = [{"name": "some_password", "type": "password", "optional": True, }] questions = [{"name": "some_password", "type": "password", "optional": True, }]
answers = {} answers = {}
expected_result = OrderedDict({"some_password": ("", "password")})
with pytest.raises(YunohostError): assert _parse_args_in_yunohost_format(answers, questions) == expected_result
_parse_args_in_yunohost_format(answers, questions)
def test_parse_args_in_yunohost_format_password_optional_with_input(): def test_parse_args_in_yunohost_format_password_optional_with_input():
@ -727,7 +727,7 @@ def test_parse_args_in_yunohost_format_boolean_optional_with_empty_input():
} }
] ]
answers = {} answers = {}
expected_result = OrderedDict({"some_boolean": (0, "boolean")}) expected_result = OrderedDict({"some_boolean": (0, "boolean")}) # default to false
with patch.object(msignals, "prompt", return_value=""): with patch.object(msignals, "prompt", return_value=""):
assert _parse_args_in_yunohost_format(answers, questions) == expected_result assert _parse_args_in_yunohost_format(answers, questions) == expected_result