mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-24 09:36:31 +00:00
Add music assistant to the builtin repositories (#5128)
* Add music assistant to the builtin repositories * Fix tests * Fix tests some more --------- Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
parent
ca7f3e8acb
commit
c37b5effd7
@ -8,11 +8,13 @@ from .const import StoreType
|
||||
|
||||
URL_COMMUNITY_ADDONS = "https://github.com/hassio-addons/repository"
|
||||
URL_ESPHOME = "https://github.com/esphome/home-assistant-addon"
|
||||
URL_MUSIC_ASSISTANT = "https://github.com/music-assistant/home-assistant-addon"
|
||||
BUILTIN_REPOSITORIES = {
|
||||
StoreType.CORE,
|
||||
StoreType.LOCAL,
|
||||
URL_COMMUNITY_ADDONS,
|
||||
URL_ESPHOME,
|
||||
URL_MUSIC_ASSISTANT,
|
||||
}
|
||||
|
||||
# pylint: disable=no-value-for-parameter
|
||||
|
5
tests/fixtures/addons/git/d5369777/repository.json
vendored
Normal file
5
tests/fixtures/addons/git/d5369777/repository.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Music Assistant",
|
||||
"url": "https://github.com/music-assistant/core",
|
||||
"maintainer": "Music Assistant <marcelveldt@users.noreply.github.com>"
|
||||
}
|
@ -163,6 +163,7 @@ async def test_preinstall_valid_repository(
|
||||
assert store_manager.get("local").validate()
|
||||
assert store_manager.get("a0d7b954").validate()
|
||||
assert store_manager.get("5c53de3b").validate()
|
||||
assert store_manager.get("d5369777").validate()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_update", [True, False])
|
||||
|
@ -39,11 +39,11 @@ async def test_default_load(coresys: CoreSys):
|
||||
):
|
||||
await store_manager.load()
|
||||
|
||||
assert len(store_manager.all) == 4
|
||||
assert len(store_manager.all) == 5
|
||||
assert isinstance(store_manager.get("core"), Repository)
|
||||
assert isinstance(store_manager.get("local"), Repository)
|
||||
|
||||
assert len(store_manager.repository_urls) == 2
|
||||
assert len(store_manager.repository_urls) == 3
|
||||
assert (
|
||||
"https://github.com/hassio-addons/repository" in store_manager.repository_urls
|
||||
)
|
||||
@ -51,6 +51,11 @@ async def test_default_load(coresys: CoreSys):
|
||||
"https://github.com/esphome/home-assistant-addon"
|
||||
in store_manager.repository_urls
|
||||
)
|
||||
assert (
|
||||
"https://github.com/music-assistant/home-assistant-addon"
|
||||
in store_manager.repository_urls
|
||||
)
|
||||
# NOTE: When adding new stores, make sure to add it to tests/fixtures/addons/git/
|
||||
assert refresh_cache_calls == {"local_ssh", "local_example", "core_samba"}
|
||||
|
||||
|
||||
@ -77,11 +82,11 @@ async def test_load_with_custom_repository(coresys: CoreSys):
|
||||
):
|
||||
await store_manager.load()
|
||||
|
||||
assert len(store_manager.all) == 5
|
||||
assert len(store_manager.all) == 6
|
||||
assert isinstance(store_manager.get("core"), Repository)
|
||||
assert isinstance(store_manager.get("local"), Repository)
|
||||
|
||||
assert len(store_manager.repository_urls) == 3
|
||||
assert len(store_manager.repository_urls) == 4
|
||||
assert (
|
||||
"https://github.com/hassio-addons/repository" in store_manager.repository_urls
|
||||
)
|
||||
@ -89,6 +94,10 @@ async def test_load_with_custom_repository(coresys: CoreSys):
|
||||
"https://github.com/esphome/home-assistant-addon"
|
||||
in store_manager.repository_urls
|
||||
)
|
||||
assert (
|
||||
"https://github.com/music-assistant/home-assistant-addon"
|
||||
in store_manager.repository_urls
|
||||
)
|
||||
assert "http://example.com" in store_manager.repository_urls
|
||||
|
||||
|
||||
@ -105,11 +114,11 @@ async def test_load_from_core_config(coresys: CoreSys):
|
||||
), patch("pathlib.Path.exists", return_value=True):
|
||||
await coresys.store.load()
|
||||
|
||||
assert len(coresys.store.all) == 5
|
||||
assert len(coresys.store.all) == 6
|
||||
assert isinstance(coresys.store.get("core"), Repository)
|
||||
assert isinstance(coresys.store.get("local"), Repository)
|
||||
|
||||
assert len(coresys.store.repository_urls) == 3
|
||||
assert len(coresys.store.repository_urls) == 4
|
||||
assert (
|
||||
"https://github.com/hassio-addons/repository" in coresys.store.repository_urls
|
||||
)
|
||||
@ -117,6 +126,10 @@ async def test_load_from_core_config(coresys: CoreSys):
|
||||
"https://github.com/esphome/home-assistant-addon"
|
||||
in coresys.store.repository_urls
|
||||
)
|
||||
assert (
|
||||
"https://github.com/music-assistant/home-assistant-addon"
|
||||
in coresys.store.repository_urls
|
||||
)
|
||||
assert "http://example.com" in coresys.store.repository_urls
|
||||
|
||||
assert coresys.config.addons_repositories == []
|
||||
@ -243,12 +256,12 @@ async def test_install_unavailable_addon(
|
||||
async def test_reload(coresys: CoreSys):
|
||||
"""Test store reload."""
|
||||
await coresys.store.load()
|
||||
assert len(coresys.store.all) == 4
|
||||
assert len(coresys.store.all) == 5
|
||||
|
||||
with patch.object(GitRepo, "pull") as git_pull:
|
||||
await coresys.store.reload()
|
||||
|
||||
assert git_pull.call_count == 3
|
||||
assert git_pull.call_count == 4
|
||||
|
||||
|
||||
async def test_addon_version_timestamp(coresys: CoreSys, install_addon_example: Addon):
|
||||
|
@ -49,12 +49,13 @@ async def test_repository_validate(repo_list: list[str], valid: bool):
|
||||
"""Test repository list validate."""
|
||||
if valid:
|
||||
processed = repositories(repo_list)
|
||||
assert len(processed) == 4
|
||||
assert len(processed) == 5
|
||||
assert set(repositories(repo_list)) == {
|
||||
"core",
|
||||
"local",
|
||||
"https://github.com/hassio-addons/repository",
|
||||
"https://github.com/esphome/home-assistant-addon",
|
||||
"https://github.com/music-assistant/home-assistant-addon",
|
||||
}
|
||||
else:
|
||||
with pytest.raises(Invalid):
|
||||
|
Loading…
x
Reference in New Issue
Block a user