mirror of
https://github.com/YunoHost-Apps/django-fritzconnection_ynh.git
synced 2024-09-03 18:26:24 +02:00
Rename screenshots and check them with a test ;)
See: https://forum.yunohost.org/t/yunohost-bot-cant-handle-spaces-in-screenshots/19483
This commit is contained in:
parent
bd24a14339
commit
8133398c6b
3 changed files with 19 additions and 1 deletions
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
@ -4,7 +4,8 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from bx_py_utils.path import assert_is_file
|
from bx_django_utils.filename import clean_filename
|
||||||
|
from bx_py_utils.path import assert_is_dir, assert_is_file
|
||||||
|
|
||||||
import djfritz
|
import djfritz
|
||||||
|
|
||||||
|
@ -69,3 +70,20 @@ def test_requirements_txt():
|
||||||
)
|
)
|
||||||
print(diff)
|
print(diff)
|
||||||
assert diff == '', f'{requirements_txt} is not up-to-date! (Hint: call: "make update")'
|
assert diff == '', f'{requirements_txt} is not up-to-date! (Hint: call: "make update")'
|
||||||
|
|
||||||
|
|
||||||
|
def test_screenshot_filenames():
|
||||||
|
"""
|
||||||
|
https://forum.yunohost.org/t/yunohost-bot-cant-handle-spaces-in-screenshots/19483
|
||||||
|
"""
|
||||||
|
screenshot_path = PACKAGE_ROOT / 'doc' / 'screenshots'
|
||||||
|
assert_is_dir(screenshot_path)
|
||||||
|
renamed = []
|
||||||
|
for file_path in screenshot_path.iterdir():
|
||||||
|
file_name = file_path.name
|
||||||
|
cleaned_name = clean_filename(file_name)
|
||||||
|
if cleaned_name != file_name:
|
||||||
|
new_path = file_path.with_name(cleaned_name)
|
||||||
|
file_path.rename(new_path)
|
||||||
|
renamed.append(f'{file_name!r} renamed to {cleaned_name!r}')
|
||||||
|
assert not renamed, f'Bad screenshots file names found: {", ".join(renamed)}'
|
||||||
|
|
Loading…
Reference in a new issue