Rename image integration to image_upload (#84063)

* Rename image integration to image_upload

* fix test
This commit is contained in:
Franck Nijhof 2022-12-16 14:16:38 +01:00 committed by GitHub
parent c51c8f7e8f
commit 80b3572627
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 24 additions and 24 deletions

View file

@ -159,8 +159,8 @@ homeassistant.components.http.*
homeassistant.components.huawei_lte.*
homeassistant.components.hyperion.*
homeassistant.components.ibeacon.*
homeassistant.components.image.*
homeassistant.components.image_processing.*
homeassistant.components.image_upload.*
homeassistant.components.input_button.*
homeassistant.components.input_select.*
homeassistant.components.integration.*

View file

@ -529,10 +529,10 @@ build.json @home-assistant/supervisor
/tests/components/icloud/ @Quentame @nzapponi
/homeassistant/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
/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/influxdb/ @mdegat01
/tests/components/influxdb/ @mdegat01

View file

@ -1,3 +0,0 @@
"""Constants for the Image integration."""
DOMAIN = "image"

View file

@ -1,4 +1,4 @@
"""The Picture integration."""
"""The Image Upload integration."""
from __future__ import annotations
import asyncio
@ -25,7 +25,7 @@ import homeassistant.util.dt as dt_util
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
STORAGE_KEY = DOMAIN
STORAGE_KEY = "image"
STORAGE_VERSION = 1
VALID_SIZES = {256, 512}
MAX_SIZE = 1024 * 1024 * 10
@ -41,13 +41,13 @@ UPDATE_FIELDS = {
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""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)
await storage_collection.async_load()
collection.StorageCollectionWebsocket(
storage_collection,
DOMAIN,
DOMAIN,
"image",
"image",
CREATE_FIELDS,
UPDATE_FIELDS,
).async_setup(hass, create_create=False)

View file

@ -0,0 +1,3 @@
"""Constants for the Image Upload integration."""
DOMAIN = "image_upload"

View file

@ -1,8 +1,8 @@
{
"domain": "image",
"name": "Image",
"domain": "image_upload",
"name": "Image Upload",
"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"],
"dependencies": ["http"],
"codeowners": ["@home-assistant/core"],

View file

@ -2,7 +2,7 @@
"domain": "person",
"name": "Person",
"documentation": "https://www.home-assistant.io/integrations/person",
"dependencies": ["image"],
"dependencies": ["image_upload"],
"after_dependencies": ["device_tracker"],
"codeowners": [],
"quality_scale": "internal",

View file

@ -1344,7 +1344,7 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.image.*]
[mypy-homeassistant.components.image_processing.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
@ -1354,7 +1354,7 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.image_processing.*]
[mypy-homeassistant.components.image_upload.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true

View file

@ -1321,7 +1321,7 @@ pilight==0.1.1
# homeassistant.components.doods
# homeassistant.components.generic
# homeassistant.components.image
# homeassistant.components.image_upload
# homeassistant.components.proxy
# homeassistant.components.qrcode
# homeassistant.components.seven_segments

View file

@ -951,7 +951,7 @@ pilight==0.1.1
# homeassistant.components.doods
# homeassistant.components.generic
# homeassistant.components.image
# homeassistant.components.image_upload
# homeassistant.components.proxy
# homeassistant.components.qrcode
# homeassistant.components.seven_segments

View file

@ -62,7 +62,7 @@ NO_IOT_CLASS = [
"homeassistant_hardware",
"homeassistant_sky_connect",
"homeassistant_yellow",
"image",
"image_upload",
"input_boolean",
"input_button",
"input_datetime",

View file

@ -9,7 +9,7 @@ from homeassistant.components import file_upload
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.components.image import TEST_IMAGE
from tests.components.image_upload import TEST_IMAGE
@pytest.fixture

View file

@ -1,4 +1,4 @@
"""Tests for the Image integration."""
"""Tests for the Image Upload integration."""
import pathlib
TEST_IMAGE = pathlib.Path(__file__).parent / "logo.png"

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -19,7 +19,7 @@ async def test_upload_image(hass, hass_client, hass_ws_client):
with tempfile.TemporaryDirectory() as tempdir, patch.object(
hass.config, "path", return_value=tempdir
), 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()
client: ClientSession = await hass_client()

View file

@ -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):
"""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):
pic = io.BytesIO(img)