mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] fix all tests that weren't formatting translated strings correctly
This commit is contained in:
parent
737f2dd967
commit
69b0d496dd
1 changed files with 6 additions and 6 deletions
|
@ -19,7 +19,7 @@ def test_read_file_missing_file():
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
read_file(bad_file)
|
read_file(bad_file)
|
||||||
|
|
||||||
translation = m18n.g('file_not_exist')
|
translation = m18n.g('file_not_exist', path=bad_file)
|
||||||
expected_msg = translation.format(path=bad_file)
|
expected_msg = translation.format(path=bad_file)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ def test_read_file_cannot_read_ioerror(test_file, mocker):
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
read_file(str(test_file))
|
read_file(str(test_file))
|
||||||
|
|
||||||
translation = m18n.g('cannot_open_file')
|
translation = m18n.g('cannot_open_file', file=str(test_file), error=error)
|
||||||
expected_msg = translation.format(file=str(test_file), error=error)
|
expected_msg = translation.format(file=str(test_file), error=error)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ def test_read_json_cannot_read(test_json, mocker):
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
read_json(str(test_json))
|
read_json(str(test_json))
|
||||||
|
|
||||||
translation = m18n.g('corrupted_json')
|
translation = m18n.g('corrupted_json', ressource=str(test_json), error=error)
|
||||||
expected_msg = translation.format(ressource=str(test_json), error=error)
|
expected_msg = translation.format(ressource=str(test_json), error=error)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ def test_write_to_existing_file_bad_perms(test_file, mocker):
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
write_to_file(str(test_file), 'yolo\nswag')
|
write_to_file(str(test_file), 'yolo\nswag')
|
||||||
|
|
||||||
translation = m18n.g('cannot_write_file')
|
translation = m18n.g('cannot_write_file', file=str(test_file), error=error)
|
||||||
expected_msg = translation.format(file=str(test_file), error=error)
|
expected_msg = translation.format(file=str(test_file), error=error)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ def test_write_to_json_bad_perms(test_json, mocker):
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
write_to_json(str(test_json), {'a': 1})
|
write_to_json(str(test_json), {'a': 1})
|
||||||
|
|
||||||
translation = m18n.g('cannot_write_file')
|
translation = m18n.g('cannot_write_file', file=str(test_json), error=error)
|
||||||
expected_msg = translation.format(file=str(test_json), error=error)
|
expected_msg = translation.format(file=str(test_json), error=error)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ def test_remove_file_bad_perms(test_file, mocker):
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
rm(str(test_file))
|
rm(str(test_file))
|
||||||
|
|
||||||
translation = m18n.g('error_removing')
|
translation = m18n.g('error_removing', path=str(test_file), error=error)
|
||||||
expected_msg = translation.format(path=str(test_file), error=error)
|
expected_msg = translation.format(path=str(test_file), error=error)
|
||||||
assert expected_msg in str(exception)
|
assert expected_msg in str(exception)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue