mirror of
https://github.com/home-assistant/core.git
synced 2026-08-07 05:46:41 +01:00
Remove unneeded test in Portainer (#178185)
This commit is contained in:
@@ -23,14 +23,14 @@ from homeassistant.components.portainer.services import (
|
||||
_async_get_device,
|
||||
)
|
||||
from homeassistant.const import ATTR_DEVICE_ID
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers.device_registry import DeviceRegistry
|
||||
|
||||
from . import setup_integration
|
||||
from .conftest import TEST_CONTAINER_ID, TEST_CONTAINER_NAME, TEST_ENTRY
|
||||
|
||||
from tests.common import MockConfigEntry, MockUser
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
TEST_ENDPOINT_ID = 1
|
||||
TEST_DEVICE_IDENTIFIER = f"{TEST_ENTRY}_{TEST_ENDPOINT_ID}"
|
||||
@@ -157,33 +157,6 @@ async def test_service_recreate_container(
|
||||
)
|
||||
|
||||
|
||||
async def test_service_recreate_container_non_admin_rejected(
|
||||
hass: HomeAssistant,
|
||||
device_registry: DeviceRegistry,
|
||||
mock_portainer_client: AsyncMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
hass_read_only_user: MockUser,
|
||||
) -> None:
|
||||
"""Test recreate container service requires admin access."""
|
||||
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
container = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, TEST_CONTAINER_DEVICE_IDENTIFIER)}
|
||||
)
|
||||
assert container is not None
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_RECREATE_CONTAINER,
|
||||
{ATTR_CONTAINER_DEVICE_ID: container.id, ATTR_PULL_IMAGE: True},
|
||||
blocking=False,
|
||||
context=Context(user_id=hass_read_only_user.id),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
mock_portainer_client.container_recreate.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("exception", "translation_key"),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user