diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 4b0dabede64..8e1caf90f2d 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -410,8 +410,6 @@ def display_version_or_commit(self) -> str: @property def pending_update(self) -> bool: """Return True if pending update.""" - if not self.can_download: - return False if self.data.installed: if self.data.selected_tag is not None: if self.data.selected_tag == self.data.default_branch: diff --git a/tests/repositories/test_display_status.py b/tests/repositories/test_display_status.py new file mode 100644 index 00000000000..cfac52e93e6 --- /dev/null +++ b/tests/repositories/test_display_status.py @@ -0,0 +1,33 @@ +"""Configuration Test Suite: can install.""" +# pylint: disable=missing-docstring +from awesomeversion import AwesomeVersion + +from custom_components.hacs.base import HacsBase + + +def test_display_status(hacs: HacsBase): + repository = hacs.repositories.get_by_full_name( + "hacs-test-org/integration-basic") + + assert repository.display_status == "default" + + repository.data.new = True + assert repository.display_status == "new" + repository.data.new = False + + repository.pending_restart = True + assert repository.display_status == "pending-restart" + repository.pending_restart = False + + repository.data.installed = True + repository.data.installed_version = "1" + repository.data.last_version = "2" + repository.data.releases = True + assert repository.display_status == "pending-upgrade" + + hacs.core.ha_version = AwesomeVersion("0.0.0") + repository.repository_manifest.homeassistant = "1.0.0" + assert repository.display_status == "pending-upgrade" + + repository.data.last_version = "1" + assert repository.display_status == "installed" diff --git a/tests/snapshots/api-usage/tests/repositories/test_display_statustest-display-status.json b/tests/snapshots/api-usage/tests/repositories/test_display_statustest-display-status.json new file mode 100644 index 00000000000..a7e16e83a49 --- /dev/null +++ b/tests/snapshots/api-usage/tests/repositories/test_display_statustest-display-status.json @@ -0,0 +1,9 @@ +{ + "tests/repositories/test_display_status.py::test_display_status": { + "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