2020-09-29 01:14:49 +00:00
|
|
|
"""Define fixtures available for all tests."""
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
|
2023-01-27 08:09:46 +00:00
|
|
|
import pytest
|
2020-09-29 01:14:49 +00:00
|
|
|
|
|
|
|
from . import MOCK_HISTORY, MOCK_STATUS, MOCK_VERSION
|
|
|
|
|
|
|
|
|
2023-01-27 08:09:46 +00:00
|
|
|
@pytest.fixture
|
2020-09-29 01:14:49 +00:00
|
|
|
def nzbget_api(hass):
|
|
|
|
"""Mock NZBGetApi for easier testing."""
|
|
|
|
with patch("homeassistant.components.nzbget.coordinator.NZBGetAPI") as mock_api:
|
|
|
|
instance = mock_api.return_value
|
|
|
|
|
|
|
|
instance.history = MagicMock(return_value=list(MOCK_HISTORY))
|
|
|
|
instance.pausedownload = MagicMock(return_value=True)
|
|
|
|
instance.resumedownload = MagicMock(return_value=True)
|
|
|
|
instance.status = MagicMock(return_value=MOCK_STATUS.copy())
|
|
|
|
instance.version = MagicMock(return_value=MOCK_VERSION)
|
|
|
|
|
|
|
|
yield mock_api
|