Skip to content

Commit

Permalink
feature(tests): added test for readme.md title (#55)
Browse files Browse the repository at this point in the history
Solved: #55
  • Loading branch information
CuberHuber committed Jan 24, 2025
1 parent b767112 commit 6eff6d2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/test_plugin_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@
@pytest.mark.pre_set
class TestPluginREADME:

def test_badges_name(self, fix_plugin_manifest):
@pytest.fixture(scope="class", autouse=True)
def readme_content(self) -> str:
with open(Path(__file__).parent.parent / 'readme.md', 'r') as file:
readme_content = file.read()
return readme_content

def test_badges_name(self, fix_plugin_manifest, readme_content):
"""Проверка соответствие имен репозитория в ссылках на шильдики GitHub"""

print(fix_plugin_manifest.plugin_name)
badge_pattern = rf'\[\!\[.*?\]\(https://github\.com/S3-Platform-Inc/{fix_plugin_manifest.plugin_name.replace("_", "-")}/actions/workflows/.*?\.yml/badge\.svg\)\]'

with open(Path(__file__).parent.parent / 'readme.md', 'r') as file:
readme_content = file.read()

found_lines = re.findall(badge_pattern, readme_content, re.MULTILINE)
assert len(found_lines) == 3, "Обновите readme.md файл. Укажите валидный url для GitHub Badges"

def test_title(self, fix_plugin_manifest, readme_content):
title_pattern = r'^# S3 Platform Plugin Template'

matched = re.match(title_pattern, readme_content)

if fix_plugin_manifest.plugin_name == "s3_platform_plugin_template":
assert matched
else:
assert not matched, "Измените название плагина в readme.md файле"

0 comments on commit 6eff6d2

Please sign in to comment.