mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Use parametrize to modify Axis test fixtures (#85884)
This commit is contained in:
parent
3627a98602
commit
8117f4af3a
@ -54,15 +54,8 @@ def config_entry_fixture(hass, config, options, config_entry_version):
|
||||
|
||||
@pytest.fixture(name="config_entry_version")
|
||||
def config_entry_version_fixture(request):
|
||||
"""Define a config entry version fixture.
|
||||
|
||||
@pytest.mark.config_entry_version(int)
|
||||
"""
|
||||
marker = request.node.get_closest_marker("config_entry_version")
|
||||
version = 3
|
||||
if marker:
|
||||
version = marker.args[0]
|
||||
return version
|
||||
"""Define a config entry version fixture."""
|
||||
return 3
|
||||
|
||||
|
||||
@pytest.fixture(name="config")
|
||||
@ -73,15 +66,8 @@ def config_fixture():
|
||||
|
||||
@pytest.fixture(name="options")
|
||||
def options_fixture(request):
|
||||
"""Define a config entry options fixture.
|
||||
|
||||
@pytest.mark.config_entry_options(dict)
|
||||
"""
|
||||
marker = request.node.get_closest_marker("config_entry_options")
|
||||
options = ENTRY_OPTIONS.copy()
|
||||
if marker:
|
||||
options = marker.args[0]
|
||||
return options
|
||||
"""Define a config entry options fixture."""
|
||||
return ENTRY_OPTIONS.copy()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
@ -50,7 +50,7 @@ async def test_camera(hass, config_entry):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.config_entry_options({CONF_STREAM_PROFILE: "profile_1"})
|
||||
@pytest.mark.parametrize("options", [{CONF_STREAM_PROFILE: "profile_1"}])
|
||||
async def test_camera_with_stream_profile(hass, config_entry):
|
||||
"""Test that Axis camera entity is using the correct path with stream profike."""
|
||||
await setup_axis_integration(hass, config_entry)
|
||||
|
@ -45,7 +45,7 @@ async def test_unload_entry(hass, config_entry):
|
||||
assert not hass.data[AXIS_DOMAIN]
|
||||
|
||||
|
||||
@pytest.mark.config_entry_version(1)
|
||||
@pytest.mark.parametrize("config_entry_version", [1])
|
||||
async def test_migrate_entry(hass, config_entry):
|
||||
"""Test successful migration of entry data."""
|
||||
assert config_entry.version == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user