2018-09-20 23:46:51 +02:00
|
|
|
"""Fixtures for cloud tests."""
|
|
|
|
import pytest
|
|
|
|
|
2019-03-11 20:21:20 +01:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2019-06-17 13:50:01 -07:00
|
|
|
from homeassistant.components.cloud import prefs
|
|
|
|
|
2018-09-20 23:46:51 +02:00
|
|
|
from . import mock_cloud, mock_cloud_prefs
|
|
|
|
|
|
|
|
|
2019-03-11 20:21:20 +01:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def mock_user_data():
|
|
|
|
"""Mock os module."""
|
|
|
|
with patch('hass_nabucasa.Cloud.write_user_info') as writer:
|
|
|
|
yield writer
|
|
|
|
|
|
|
|
|
2018-09-20 23:46:51 +02:00
|
|
|
@pytest.fixture
|
|
|
|
def mock_cloud_fixture(hass):
|
|
|
|
"""Fixture for cloud component."""
|
|
|
|
mock_cloud(hass)
|
|
|
|
return mock_cloud_prefs(hass)
|
2019-06-17 13:50:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
async def cloud_prefs(hass):
|
|
|
|
"""Fixture for cloud preferences."""
|
|
|
|
cloud_prefs = prefs.CloudPreferences(hass)
|
|
|
|
await cloud_prefs.async_initialize()
|
|
|
|
return cloud_prefs
|