mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-04-23 12:47:16 +00:00

* Support armv7 and first abstraction * Change layout * Add more type hints * Fix imports * Update * move forward * add tests * fix type * fix lint & tests * fix tests * Fix unittests * Fix create folder * cleanup * Fix import order * cleanup loop parameter * cleanup init function * Allow changeable image name * fix setup * Fix load of arch * Fix lint * Add typing * fix init * fix hassos cli problem & stick on supervisor arch * address comments * cleanup * Fix image selfheal * Add comment * update uvloop * remove uvloop * fix tagging * Fix install name * Fix validate build config * Abstract image_name from system cache
43 lines
946 B
Python
43 lines
946 B
Python
"""Common test functions."""
|
|
from unittest.mock import patch, PropertyMock, MagicMock
|
|
|
|
import pytest
|
|
|
|
from hassio.bootstrap import initialize_coresys
|
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
|
|
@pytest.fixture
|
|
def docker():
|
|
"""Mock Docker API."""
|
|
with patch('hassio.coresys.DockerAPI') as mock:
|
|
yield mock
|
|
|
|
|
|
@pytest.fixture
|
|
async def coresys(loop, docker):
|
|
"""Create a CoreSys Mock."""
|
|
with patch('hassio.bootstrap.initialize_system_data'):
|
|
coresys_obj = await initialize_coresys()
|
|
|
|
yield coresys_obj
|
|
|
|
|
|
@pytest.fixture
|
|
def sys_machine():
|
|
"""Mock sys_machine."""
|
|
with patch(
|
|
'hassio.coresys.CoreSys.machine',
|
|
new_callable=PropertyMock) as mock:
|
|
yield mock
|
|
|
|
|
|
@pytest.fixture
|
|
def sys_supervisor():
|
|
with patch(
|
|
'hassio.coresys.CoreSys.supervisor',
|
|
new_callable=PropertyMock) as mock:
|
|
mock.return_value = MagicMock()
|
|
yield MagicMock
|