mirror of
https://github.com/home-assistant/core.git
synced 2025-08-12 00:55:26 +02:00
Mock dependency
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
import io
|
import io
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from homeassistant import core as ha
|
from homeassistant import core as ha
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
from tests.components.auth import async_setup_auth
|
from tests.components.auth import async_setup_auth
|
||||||
|
|
||||||
|
@mock.patch("PIL.Image.new")
|
||||||
async def test_bad_posting(aioclient_mock, hass, aiohttp_client):
|
async def test_bad_posting(aioclient_mock, hass, aiohttp_client):
|
||||||
"""Test that posting to wrong api endpoint fails."""
|
"""Test that posting to wrong api endpoint fails."""
|
||||||
await async_setup_component(hass, 'camera', {
|
await async_setup_component(hass, 'camera', {
|
||||||
@@ -29,7 +30,7 @@ async def test_bad_posting(aioclient_mock, hass, aiohttp_client):
|
|||||||
resp = await client.post('/api/camera_push/camera.wrong', data=files)
|
resp = await client.post('/api/camera_push/camera.wrong', data=files)
|
||||||
assert resp.status == 400
|
assert resp.status == 400
|
||||||
|
|
||||||
|
@mock.patch("PIL.Image.new")
|
||||||
async def test_posting_url(aioclient_mock, hass, aiohttp_client):
|
async def test_posting_url(aioclient_mock, hass, aiohttp_client):
|
||||||
"""Test that posting to api endpoint works."""
|
"""Test that posting to api endpoint works."""
|
||||||
await async_setup_component(hass, 'camera', {
|
await async_setup_component(hass, 'camera', {
|
||||||
|
Reference in New Issue
Block a user