* Add config flow to AnthemAV integration * Add importing of existing configuration * Change setting to optional and add default value * Use entity attribute * Reduce changes by removing additional media player properties * Remove title from translation * Refactor config flow and fix PR comments * Fix a failing test because of wrong renaming * Add typing and use existing class and enum * Bump dependency to v1.3.1 * Remove unecessary async_reload_entry * Fix requirements_test_all after rebase * Add const for timeout and remove async_block in test * Reapply CodeOwner and configflow after rebase * Remove name from configflow * Fix manifest prettier failure * Simplify code and avoid catching broad exception * Removed unused strings and translations * Avoid asserting hass.data
28 lines
737 B
Python
28 lines
737 B
Python
"""Fixtures for anthemav integration tests."""
|
|
from unittest.mock import AsyncMock, MagicMock, patch
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_anthemav() -> AsyncMock:
|
|
"""Return the default mocked anthemav."""
|
|
avr = AsyncMock()
|
|
avr.protocol.macaddress = "000000000001"
|
|
avr.protocol.model = "MRX 520"
|
|
avr.reconnect = AsyncMock()
|
|
avr.close = MagicMock()
|
|
avr.protocol.input_list = []
|
|
avr.protocol.audio_listening_mode_list = []
|
|
return avr
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_connection_create(mock_anthemav: AsyncMock) -> AsyncMock:
|
|
"""Return the default mocked connection.create."""
|
|
|
|
with patch(
|
|
"anthemav.Connection.create",
|
|
return_value=mock_anthemav,
|
|
) as mock:
|
|
yield mock
|