1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 20:35:55 +00:00
Files
supervisor/tests/store/test_reading_addons.py
Mike Degatano 222c3fd485 Address addon storage race condition (#4481)
* Address addon storage race condition

* Add some error test cases
2023-08-10 15:24:43 -04:00

26 lines
840 B
Python

"""Test that we are reading add-on files correctly."""
from pathlib import Path
from unittest.mock import patch
from supervisor.coresys import CoreSys
async def test_read_addon_files(coresys: CoreSys):
"""Test that we are reading add-on files correctly."""
with patch(
"pathlib.Path.glob",
return_value=[
Path("addon/config.yml"),
Path(".git/config.yml"),
Path("somepath/.git/config.yml"),
Path("somepath/deeper_in_the_structure/.github/config.yml"),
Path(".github/config.yml"),
Path("some/rootfs/config.yml"),
Path(".circleci/config.yml"),
],
):
addon_list = await coresys.store.data._find_addons(Path("test"), {})
assert len(addon_list) == 1
assert str(addon_list[0]) == "addon/config.yml"