Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check that required fields are not empty #7

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ test-requirements:
test: test-lint test-unit test-types test-format ## Run all tests by decreasing order of priority

test-format: ## Run code formatting tests
black --check --diff tests.py
black --check --diff *.py

test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates tests.py
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates *.py

test-unit: ## Run unit tests
python -m unittest run ./tests.py

test-types: ## Check type definitions
mypy --ignore-missing-imports --implicit-reexport --strict tests.py
mypy --ignore-missing-imports --implicit-reexport --strict *.py

format: ## Format code
black *.py
12 changes: 7 additions & 5 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ def test_names_are_unique(self) -> None:
names.add(plugin["name"])

def test_all_plugins_have_all_fields(self) -> None:
required_fields = ["src", "url", "author", "maintainer", "description"]
for release in RELEASES:
for index in INDEXES:
for plugin in load_index(release, index):
self.assertIn("src", plugin)
self.assertIn("url", plugin)
self.assertIn("author", plugin)
self.assertIn("maintainer", plugin)
self.assertIn("description", plugin)
for field in required_fields:
self.assertIn(field, plugin)
self.assertTrue(
plugin[field] and plugin[field].strip(),
f"Field {field} cannot be empty",
)


def load_index(release: str, index: str) -> list[dict[str, str]]:
Expand Down
Loading