mirror of
https://github.com/YunoHost-Apps/django-fmd_ynh.git
synced 2024-09-03 18:26:27 +02:00
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
|
from pathlib import Path
|
||
|
|
||
|
from bx_py_utils.auto_doc import assert_readme_block
|
||
|
from django_fmd_ynh.cli.dev import PACKAGE_ROOT, cli
|
||
|
from django_fmd_ynh.constants import CLI_EPILOG
|
||
|
from manageprojects.test_utils.click_cli_utils import invoke_click
|
||
|
from manageprojects.tests.base import BaseTestCase
|
||
|
|
||
|
|
||
|
def assert_cli_help_in_readme(text_block: str, marker: str, readme_path: Path):
|
||
|
text_block = text_block.replace(CLI_EPILOG, '')
|
||
|
text_block = f'```\n{text_block.strip()}\n```'
|
||
|
assert_readme_block(
|
||
|
readme_path=readme_path,
|
||
|
text_block=text_block,
|
||
|
start_marker_line=f'[comment]: <> (✂✂✂ auto generated {marker} start ✂✂✂)',
|
||
|
end_marker_line=f'[comment]: <> (✂✂✂ auto generated {marker} end ✂✂✂)',
|
||
|
)
|
||
|
|
||
|
|
||
|
class ReadmeTestCase(BaseTestCase):
|
||
|
def test_main_help(self):
|
||
|
stdout = invoke_click(cli, '--help')
|
||
|
self.assert_in_content(
|
||
|
got=stdout,
|
||
|
parts=(
|
||
|
'Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...',
|
||
|
' local-test ',
|
||
|
CLI_EPILOG,
|
||
|
),
|
||
|
)
|
||
|
assert_cli_help_in_readme(
|
||
|
text_block=stdout,
|
||
|
marker='help',
|
||
|
readme_path=PACKAGE_ROOT / 'doc' / 'ADMIN.md',
|
||
|
)
|