Skip to content

Commit

Permalink
test for both outcomes
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Oct 15, 2023
1 parent 10357bb commit e7b796a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions custom_components/hacs/validate/hacsjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async def async_validate(self):
raise ValidationException("zip_release is True, but filename is not set")

for language, filename in (hacsjson.documentation or {}).items():
raise ValidationException(
f"The '{filename}' file for the 'documentation[{language}]' key does not exist",
warning=True,
)
if filename not in files:
raise ValidationException(
f"The '{filename}' file for the 'documentation[{language}]' key does not exist",
warning=True,
)
7 changes: 6 additions & 1 deletion tests/validate/test_hacsjson_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ async def test_hacs_manifest_no_manifest(repository):
@pytest.mark.asyncio
async def test_hacs_manifest_with_valid_manifest(repository):
repository.tree = test_tree
repository.tree.append(
AIOGitHubAPIRepositoryTreeContent(
{"path": "docs/README.nb.md", "type": "file"}, "test/test", "main"
),
)

async def _async_get_hacs_json(_):
return {"name": "test"}
return {"name": "test", "documentation": {"en": "README.md", "nb": "docs/README.nb.md"}}

repository.async_get_hacs_json = _async_get_hacs_json

Expand Down

0 comments on commit e7b796a

Please sign in to comment.