1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Refactoring around add-on store Repository classes (#5990)

* Rename repository fixture to test_repository

Also don't remove the built-in repositories. The list was incomplete,
and tests don't seem to require that anymore.

* Get rid of StoreType

The type doesn't have much value, we have constant strings anyways.

* Introduce types.py

* Use slug to determine which repository urls to return

* Simplify BuiltinRepository enum

* Mock GitRepo load

* Improve URL handling and repository creation logic

* Refactor update_repositories

* Get rid of get_from_url

It is no longer used in production code.

* More refactoring

* Address pylint

* Introduce is_git_based property to Repository class

Return all git based URLs, including the Core repository.

* Revert "Introduce is_git_based property to Repository class"

This reverts commit dfd5ad79bf.

* Fold type.py into const.py

Align more with how Supervisor code is typically structured.

* Update supervisor/store/__init__.py

Co-authored-by: Mike Degatano <michael.degatano@gmail.com>

* Apply repository remove suggestion

* Fix tests

---------

Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
This commit is contained in:
Stefan Agner
2025-07-10 11:07:53 +02:00
committed by GitHub
parent 7873c457d5
commit baf9695cf7
16 changed files with 247 additions and 235 deletions

View File

@@ -54,7 +54,7 @@ async def test_addons_info(
# DEPRECATED - Remove with legacy routing logic on 1/2023
async def test_addons_info_not_installed(
api_client: TestClient, coresys: CoreSys, repository: Repository
api_client: TestClient, coresys: CoreSys, test_repository: Repository
):
"""Test getting addon info for not installed addon."""
resp = await api_client.get(f"/addons/{TEST_ADDON_SLUG}/info")
@@ -533,7 +533,7 @@ async def test_addon_not_found(
("get", "/addons/local_ssh/logs/boots/1/follow", False),
],
)
@pytest.mark.usefixtures("repository")
@pytest.mark.usefixtures("test_repository")
async def test_addon_not_installed(
api_client: TestClient, method: str, url: str, json_expected: bool
):