diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 950f52facd3..9a8181b4f51 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -14,6 +14,7 @@ from aiogithubapi import ( AIOGitHubAPIException, AIOGitHubAPINotModifiedException, + GitHubReleaseAssetModel, GitHubReleaseModel, ) from aiogithubapi.objects.repository import AIOGitHubAPIRepository @@ -1133,8 +1134,8 @@ async def common_update_data( for release in self.releases.objects or []: if release.tag_name == self.ref: if assets := release.assets: - downloads = next(iter(assets)).download_count - self.data.downloads = downloads + if target_asset := self._find_target_asset(assets): + self.data.downloads = target_asset.download_count elif self.hacs.system.generator and self.repository_object: await self.repository_object.set_last_commit() self.data.last_commit = self.repository_object.last_commit @@ -1386,6 +1387,36 @@ async def get_hacs_json_raw( ) return json_loads(result) if result else None + def _find_target_asset( + self, + assets: list[GitHubReleaseAssetModel] | None, + ) -> GitHubReleaseAssetModel | None: + """Find the correct asset for download.""" + if not assets: + return None + + if self.data.file_name: + for asset in assets: + if asset.name == self.data.file_name: + return asset + + if self.data.category == "plugin": + valid_filenames = ( + f"{self.data.name}.js", + f"{self.data.name}-bundle.js", + f"{self.data.name}.umd.js", + ) + for asset in assets: + if asset.name in valid_filenames: + return asset + + if target_filename := self.repository_manifest.filename: + for asset in assets: + if asset.name == target_filename: + return asset + + return assets[0] if assets else None + async def _ensure_download_capabilities(self, ref: str | None, **kwargs: Any) -> None: """Ensure that the download can be handled.""" target_manifest: HacsManifest | None = None diff --git a/tests/repositories/test_download_counting.py b/tests/repositories/test_download_counting.py new file mode 100644 index 00000000000..6c337da23e0 --- /dev/null +++ b/tests/repositories/test_download_counting.py @@ -0,0 +1,378 @@ +"""Test download counting functionality.""" +from aiogithubapi import GitHubReleaseAssetModel +from aiogithubapi.models.release import GitHubReleaseModel + + +def test_find_target_asset_with_configured_filename(repository): + """Test finding asset when filename is configured.""" + repository.data.file_name = "specific-file.js" + + assets = [ + GitHubReleaseAssetModel( + {"name": "wrong-file.js", "download_count": 50}), + GitHubReleaseAssetModel( + {"name": "specific-file.js", "download_count": 200}), + GitHubReleaseAssetModel( + {"name": "another-file.js", "download_count": 150}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "specific-file.js" + assert result.download_count == 200 + + +def test_find_target_asset_plugin_patterns(repository_plugin): + """Test finding asset for plugins using naming patterns.""" + repository = repository_plugin + repository.data.full_name = "user/test-card" + repository.data.file_name = None + + assets = [ + GitHubReleaseAssetModel({"name": "README.md", "download_count": 10}), + GitHubReleaseAssetModel( + {"name": "test-card.js", "download_count": 500}), + GitHubReleaseAssetModel( + {"name": "other-file.js", "download_count": 50}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "test-card.js" + assert result.download_count == 500 + + +def test_find_target_asset_plugin_bundle_pattern(repository_plugin): + """Test finding asset for plugins using bundle pattern.""" + repository = repository_plugin + repository.data.full_name = "user/test-card" + repository.data.file_name = None + + assets = [ + GitHubReleaseAssetModel({"name": "README.md", "download_count": 10}), + GitHubReleaseAssetModel( + {"name": "test-card-bundle.js", "download_count": 300}), + GitHubReleaseAssetModel( + {"name": "other-file.js", "download_count": 50}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "test-card-bundle.js" + assert result.download_count == 300 + + +def test_find_target_asset_plugin_umd_pattern(repository_plugin): + """Test finding asset for plugins using UMD pattern.""" + repository = repository_plugin + repository.data.full_name = "user/test-card" + repository.data.file_name = None + + assets = [ + GitHubReleaseAssetModel({"name": "README.md", "download_count": 10}), + GitHubReleaseAssetModel( + {"name": "test-card.umd.js", "download_count": 400}), + GitHubReleaseAssetModel( + {"name": "other-file.js", "download_count": 50}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "test-card.umd.js" + assert result.download_count == 400 + + +def test_find_target_asset_with_manifest_filename(repository): + """Test finding asset using manifest filename.""" + repository.data.file_name = None + repository.repository_manifest.filename = "manifest-specified.js" + + assets = [ + GitHubReleaseAssetModel( + {"name": "wrong-file.js", "download_count": 50}), + GitHubReleaseAssetModel( + {"name": "manifest-specified.js", "download_count": 250}), + GitHubReleaseAssetModel( + {"name": "another-file.js", "download_count": 150}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "manifest-specified.js" + assert result.download_count == 250 + + +def test_find_target_asset_fallback_to_first(repository): + """Test fallback to first asset when no specific match.""" + repository.data.file_name = None + + assets = [ + GitHubReleaseAssetModel( + {"name": "first-file.zip", "download_count": 100}), + GitHubReleaseAssetModel( + {"name": "second-file.zip", "download_count": 200}), + GitHubReleaseAssetModel( + {"name": "third-file.zip", "download_count": 300}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "first-file.zip" + assert result.download_count == 100 + + +def test_find_target_asset_empty_assets(repository): + """Test handling empty asset list.""" + result = repository._find_target_asset([]) + assert result is None + + +def test_find_target_asset_none_assets(repository): + """Test handling None asset list.""" + result = repository._find_target_asset(None) + assert result is None + + +def test_find_target_asset_priority_order(repository_plugin): + """Test that specific filename takes priority over plugin patterns.""" + repository = repository_plugin + repository.data.full_name = "user/test-card" + repository.data.file_name = "specific-file.js" + + assets = [ + GitHubReleaseAssetModel( + {"name": "test-card.js", "download_count": 100}), + GitHubReleaseAssetModel( + {"name": "specific-file.js", "download_count": 200}), + GitHubReleaseAssetModel( + {"name": "test-card-bundle.js", "download_count": 300}), + ] + + result = repository._find_target_asset(assets) + assert result is not None + assert result.name == "specific-file.js" + assert result.download_count == 200 + + +def test_download_counting_with_single_asset(repository): + """Test download counting with single asset.""" + repository.data.releases = True + repository.data.file_name = "test.zip" + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [{"name": "test.zip", "download_count": 1500}] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 1500 + + +def test_download_counting_with_multiple_assets(repository): + """Test download counting with multiple assets.""" + repository.data.releases = True + repository.data.file_name = "main.zip" + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [ + {"name": "source-code.zip", "download_count": 5000}, + {"name": "main.zip", "download_count": 2000}, + {"name": "docs.pdf", "download_count": 100}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 2000 + + +def test_download_counting_plugin_with_multiple_assets(repository_plugin): + """Test download counting for plugin with multiple assets.""" + repository = repository_plugin + repository.data.releases = True + repository.data.full_name = "user/my-card" + repository.data.file_name = None + repository.ref = "v2.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v2.0.0", + "assets": [ + {"name": "source-code.zip", "download_count": 8000}, + {"name": "my-card.js", "download_count": 3000}, + {"name": "README.md", "download_count": 50}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 3000 + + +def test_download_counting_fallback_to_first_asset(repository): + """Test download counting falls back to first asset when no specific match.""" + repository.data.releases = True + repository.data.file_name = None + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [ + {"name": "random-file.zip", "download_count": 1000}, + {"name": "another-file.tar.gz", "download_count": 500}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 1000 + + +def test_download_counting_no_matching_release(repository): + """Test download counting when no release matches the ref.""" + repository.data.releases = True + repository.ref = "v2.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [{"name": "test.zip", "download_count": 1000}] + }) + repository.releases.objects = [release] + + repository.data.downloads = 0 + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 0 + + +def test_download_counting_release_with_no_assets(repository): + """Test download counting when release has no assets.""" + repository.data.releases = True + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [] + }) + repository.releases.objects = [release] + + repository.data.downloads = 0 + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 0 + + +def test_regression_multiple_assets_first_not_selected(repository): + """Test that the first asset is not always selected (regression test).""" + repository.data.releases = True + repository.data.file_name = "target-file.zip" + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [ + {"name": "wrong-file.zip", "download_count": 10000}, + {"name": "target-file.zip", "download_count": 5000}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 5000 + + +def test_regression_plugin_pattern_matching(repository_plugin): + """Test that plugin assets are selected by pattern, not position.""" + repository = repository_plugin + repository.data.releases = True + repository.data.full_name = "user/test-component" + repository.data.file_name = None + repository.ref = "v1.0.0" + + release = GitHubReleaseModel({ + "tag_name": "v1.0.0", + "assets": [ + {"name": "README.md", "download_count": 50}, + {"name": "test-component.js", "download_count": 3000}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 3000 + + +def test_regression_github_issue_4438_scenario(repository): + """Test the specific scenario from GitHub issue #4438.""" + repository.data.releases = True + repository.data.file_name = "mbapi2020.zip" + repository.ref = "v2.5.0" + + release = GitHubReleaseModel({ + "tag_name": "v2.5.0", + "assets": [ + {"name": "Source code (zip)", "download_count": 4000}, + {"name": "mbapi2020.zip", "download_count": 190}, + ] + }) + repository.releases.objects = [release] + + for release in repository.releases.objects: + if release.tag_name == repository.ref: + if assets := release.assets: + target_asset = repository._find_target_asset(assets) + if target_asset: + repository.data.downloads = target_asset.download_count + + assert repository.data.downloads == 190 diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-fallback-to-first-asset.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-fallback-to-first-asset.json new file mode 100644 index 00000000000..52a3fa37441 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-fallback-to-first-asset.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_fallback_to_first_asset": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-no-matching-release.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-no-matching-release.json new file mode 100644 index 00000000000..a2a9ea34633 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-no-matching-release.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_no_matching_release": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-plugin-with-multiple-assets.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-plugin-with-multiple-assets.json new file mode 100644 index 00000000000..316eda1669e --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-plugin-with-multiple-assets.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_plugin_with_multiple_assets": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-release-with-no-assets.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-release-with-no-assets.json new file mode 100644 index 00000000000..845d706765e --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-release-with-no-assets.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_release_with_no_assets": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-multiple-assets.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-multiple-assets.json new file mode 100644 index 00000000000..429ebb15360 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-multiple-assets.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_with_multiple_assets": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-single-asset.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-single-asset.json new file mode 100644 index 00000000000..96f200b580f --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-download-counting-with-single-asset.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_download_counting_with_single_asset": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-empty-assets.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-empty-assets.json new file mode 100644 index 00000000000..2a4b529dbc4 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-empty-assets.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_empty_assets": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-fallback-to-first.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-fallback-to-first.json new file mode 100644 index 00000000000..c98670c9ffc --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-fallback-to-first.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_fallback_to_first": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-none-assets.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-none-assets.json new file mode 100644 index 00000000000..0c39acd2e6d --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-none-assets.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_none_assets": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-bundle-pattern.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-bundle-pattern.json new file mode 100644 index 00000000000..3e9f2ca2738 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-bundle-pattern.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_plugin_bundle_pattern": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-patterns.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-patterns.json new file mode 100644 index 00000000000..8bef7b5bbec --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-patterns.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_plugin_patterns": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-umd-pattern.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-umd-pattern.json new file mode 100644 index 00000000000..ea8b8e0bbc4 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-plugin-umd-pattern.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_plugin_umd_pattern": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-priority-order.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-priority-order.json new file mode 100644 index 00000000000..4186f2cd397 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-priority-order.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_priority_order": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-configured-filename.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-configured-filename.json new file mode 100644 index 00000000000..6f023451103 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-configured-filename.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_with_configured_filename": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-manifest-filename.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-manifest-filename.json new file mode 100644 index 00000000000..9624c988b6d --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-find-target-asset-with-manifest-filename.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_find_target_asset_with_manifest_filename": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-github-issue-4438-scenario.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-github-issue-4438-scenario.json new file mode 100644 index 00000000000..5e7d3591692 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-github-issue-4438-scenario.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_regression_github_issue_4438_scenario": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-multiple-assets-first-not-selected.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-multiple-assets-first-not-selected.json new file mode 100644 index 00000000000..f527e7bec90 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-multiple-assets-first-not-selected.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_regression_multiple_assets_first_not_selected": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file diff --git a/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-plugin-pattern-matching.json b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-plugin-pattern-matching.json new file mode 100644 index 00000000000..cbed474ec7f --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_download_countingtest-regression-plugin-pattern-matching.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_download_counting.py::test_regression_plugin_pattern_matching": { + "https://api.github.com/repos/hacs/integration": 1, + "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, + "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, + "https://api.github.com/repos/hacs/integration/git/trees/main": 1, + "https://api.github.com/repos/hacs/integration/releases": 1 + } +} \ No newline at end of file