mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Rename image integration to image_upload (#84063)
* Rename image integration to image_upload * fix test
This commit is contained in:
parent
c51c8f7e8f
commit
80b3572627
@ -159,8 +159,8 @@ homeassistant.components.http.*
|
|||||||
homeassistant.components.huawei_lte.*
|
homeassistant.components.huawei_lte.*
|
||||||
homeassistant.components.hyperion.*
|
homeassistant.components.hyperion.*
|
||||||
homeassistant.components.ibeacon.*
|
homeassistant.components.ibeacon.*
|
||||||
homeassistant.components.image.*
|
|
||||||
homeassistant.components.image_processing.*
|
homeassistant.components.image_processing.*
|
||||||
|
homeassistant.components.image_upload.*
|
||||||
homeassistant.components.input_button.*
|
homeassistant.components.input_button.*
|
||||||
homeassistant.components.input_select.*
|
homeassistant.components.input_select.*
|
||||||
homeassistant.components.integration.*
|
homeassistant.components.integration.*
|
||||||
|
@ -529,10 +529,10 @@ build.json @home-assistant/supervisor
|
|||||||
/tests/components/icloud/ @Quentame @nzapponi
|
/tests/components/icloud/ @Quentame @nzapponi
|
||||||
/homeassistant/components/ign_sismologia/ @exxamalte
|
/homeassistant/components/ign_sismologia/ @exxamalte
|
||||||
/tests/components/ign_sismologia/ @exxamalte
|
/tests/components/ign_sismologia/ @exxamalte
|
||||||
/homeassistant/components/image/ @home-assistant/core
|
|
||||||
/tests/components/image/ @home-assistant/core
|
|
||||||
/homeassistant/components/image_processing/ @home-assistant/core
|
/homeassistant/components/image_processing/ @home-assistant/core
|
||||||
/tests/components/image_processing/ @home-assistant/core
|
/tests/components/image_processing/ @home-assistant/core
|
||||||
|
/homeassistant/components/image_upload/ @home-assistant/core
|
||||||
|
/tests/components/image_upload/ @home-assistant/core
|
||||||
/homeassistant/components/incomfort/ @zxdavb
|
/homeassistant/components/incomfort/ @zxdavb
|
||||||
/homeassistant/components/influxdb/ @mdegat01
|
/homeassistant/components/influxdb/ @mdegat01
|
||||||
/tests/components/influxdb/ @mdegat01
|
/tests/components/influxdb/ @mdegat01
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
"""Constants for the Image integration."""
|
|
||||||
|
|
||||||
DOMAIN = "image"
|
|
@ -1,4 +1,4 @@
|
|||||||
"""The Picture integration."""
|
"""The Image Upload integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -25,7 +25,7 @@ import homeassistant.util.dt as dt_util
|
|||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
STORAGE_KEY = DOMAIN
|
STORAGE_KEY = "image"
|
||||||
STORAGE_VERSION = 1
|
STORAGE_VERSION = 1
|
||||||
VALID_SIZES = {256, 512}
|
VALID_SIZES = {256, 512}
|
||||||
MAX_SIZE = 1024 * 1024 * 10
|
MAX_SIZE = 1024 * 1024 * 10
|
||||||
@ -41,13 +41,13 @@ UPDATE_FIELDS = {
|
|||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Image integration."""
|
"""Set up the Image integration."""
|
||||||
image_dir = pathlib.Path(hass.config.path(DOMAIN))
|
image_dir = pathlib.Path(hass.config.path("image"))
|
||||||
hass.data[DOMAIN] = storage_collection = ImageStorageCollection(hass, image_dir)
|
hass.data[DOMAIN] = storage_collection = ImageStorageCollection(hass, image_dir)
|
||||||
await storage_collection.async_load()
|
await storage_collection.async_load()
|
||||||
collection.StorageCollectionWebsocket(
|
collection.StorageCollectionWebsocket(
|
||||||
storage_collection,
|
storage_collection,
|
||||||
DOMAIN,
|
"image",
|
||||||
DOMAIN,
|
"image",
|
||||||
CREATE_FIELDS,
|
CREATE_FIELDS,
|
||||||
UPDATE_FIELDS,
|
UPDATE_FIELDS,
|
||||||
).async_setup(hass, create_create=False)
|
).async_setup(hass, create_create=False)
|
3
homeassistant/components/image_upload/const.py
Normal file
3
homeassistant/components/image_upload/const.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"""Constants for the Image Upload integration."""
|
||||||
|
|
||||||
|
DOMAIN = "image_upload"
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"domain": "image",
|
"domain": "image_upload",
|
||||||
"name": "Image",
|
"name": "Image Upload",
|
||||||
"config_flow": false,
|
"config_flow": false,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/image",
|
"documentation": "https://www.home-assistant.io/integrations/image_upload",
|
||||||
"requirements": ["pillow==9.3.0"],
|
"requirements": ["pillow==9.3.0"],
|
||||||
"dependencies": ["http"],
|
"dependencies": ["http"],
|
||||||
"codeowners": ["@home-assistant/core"],
|
"codeowners": ["@home-assistant/core"],
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "person",
|
"domain": "person",
|
||||||
"name": "Person",
|
"name": "Person",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/person",
|
"documentation": "https://www.home-assistant.io/integrations/person",
|
||||||
"dependencies": ["image"],
|
"dependencies": ["image_upload"],
|
||||||
"after_dependencies": ["device_tracker"],
|
"after_dependencies": ["device_tracker"],
|
||||||
"codeowners": [],
|
"codeowners": [],
|
||||||
"quality_scale": "internal",
|
"quality_scale": "internal",
|
||||||
|
4
mypy.ini
4
mypy.ini
@ -1344,7 +1344,7 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.image.*]
|
[mypy-homeassistant.components.image_processing.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
disallow_subclassing_any = true
|
disallow_subclassing_any = true
|
||||||
@ -1354,7 +1354,7 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.image_processing.*]
|
[mypy-homeassistant.components.image_upload.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
disallow_subclassing_any = true
|
disallow_subclassing_any = true
|
||||||
|
@ -1321,7 +1321,7 @@ pilight==0.1.1
|
|||||||
|
|
||||||
# homeassistant.components.doods
|
# homeassistant.components.doods
|
||||||
# homeassistant.components.generic
|
# homeassistant.components.generic
|
||||||
# homeassistant.components.image
|
# homeassistant.components.image_upload
|
||||||
# homeassistant.components.proxy
|
# homeassistant.components.proxy
|
||||||
# homeassistant.components.qrcode
|
# homeassistant.components.qrcode
|
||||||
# homeassistant.components.seven_segments
|
# homeassistant.components.seven_segments
|
||||||
|
@ -951,7 +951,7 @@ pilight==0.1.1
|
|||||||
|
|
||||||
# homeassistant.components.doods
|
# homeassistant.components.doods
|
||||||
# homeassistant.components.generic
|
# homeassistant.components.generic
|
||||||
# homeassistant.components.image
|
# homeassistant.components.image_upload
|
||||||
# homeassistant.components.proxy
|
# homeassistant.components.proxy
|
||||||
# homeassistant.components.qrcode
|
# homeassistant.components.qrcode
|
||||||
# homeassistant.components.seven_segments
|
# homeassistant.components.seven_segments
|
||||||
|
@ -62,7 +62,7 @@ NO_IOT_CLASS = [
|
|||||||
"homeassistant_hardware",
|
"homeassistant_hardware",
|
||||||
"homeassistant_sky_connect",
|
"homeassistant_sky_connect",
|
||||||
"homeassistant_yellow",
|
"homeassistant_yellow",
|
||||||
"image",
|
"image_upload",
|
||||||
"input_boolean",
|
"input_boolean",
|
||||||
"input_button",
|
"input_button",
|
||||||
"input_datetime",
|
"input_datetime",
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components import file_upload
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.components.image import TEST_IMAGE
|
from tests.components.image_upload import TEST_IMAGE
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Tests for the Image integration."""
|
"""Tests for the Image Upload integration."""
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
TEST_IMAGE = pathlib.Path(__file__).parent / "logo.png"
|
TEST_IMAGE = pathlib.Path(__file__).parent / "logo.png"
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
@ -19,7 +19,7 @@ async def test_upload_image(hass, hass_client, hass_ws_client):
|
|||||||
with tempfile.TemporaryDirectory() as tempdir, patch.object(
|
with tempfile.TemporaryDirectory() as tempdir, patch.object(
|
||||||
hass.config, "path", return_value=tempdir
|
hass.config, "path", return_value=tempdir
|
||||||
), patch("homeassistant.util.dt.utcnow", return_value=now):
|
), patch("homeassistant.util.dt.utcnow", return_value=now):
|
||||||
assert await async_setup_component(hass, "image", {})
|
assert await async_setup_component(hass, "image_upload", {})
|
||||||
ws_client: ClientWebSocketResponse = await hass_ws_client()
|
ws_client: ClientWebSocketResponse = await hass_ws_client()
|
||||||
client: ClientSession = await hass_client()
|
client: ClientSession = await hass_client()
|
||||||
|
|
@ -125,7 +125,7 @@ async def test_media_view(hass, hass_client):
|
|||||||
async def test_upload_view(hass, hass_client, temp_dir, hass_admin_user):
|
async def test_upload_view(hass, hass_client, temp_dir, hass_admin_user):
|
||||||
"""Allow uploading media."""
|
"""Allow uploading media."""
|
||||||
|
|
||||||
img = (Path(__file__).parent.parent / "image/logo.png").read_bytes()
|
img = (Path(__file__).parent.parent / "image_upload/logo.png").read_bytes()
|
||||||
|
|
||||||
def get_file(name):
|
def get_file(name):
|
||||||
pic = io.BytesIO(img)
|
pic = io.BytesIO(img)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user