Skip to content

Commit

Permalink
Show all pending updates (#4024)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Sep 2, 2024
1 parent e78afd1 commit 756d4e9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 0 additions & 2 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
33 changes: 33 additions & 0 deletions tests/repositories/test_display_status.py
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 756d4e9

Please sign in to comment.