mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Extract Netatmo test data (#40094)
This commit is contained in:
parent
74cef6966d
commit
f651b1f54b
@ -1,4 +1,6 @@
|
|||||||
"""Test Local Media Source."""
|
"""Test Local Media Source."""
|
||||||
|
import ast
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components import media_source
|
from homeassistant.components import media_source
|
||||||
@ -7,6 +9,8 @@ from homeassistant.components.media_source.models import PlayMedia
|
|||||||
from homeassistant.components.netatmo import DATA_CAMERAS, DATA_EVENTS, DOMAIN
|
from homeassistant.components.netatmo import DATA_CAMERAS, DATA_EVENTS, DOMAIN
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
from tests.common import load_fixture
|
||||||
|
|
||||||
|
|
||||||
async def test_async_browse_media(hass):
|
async def test_async_browse_media(hass):
|
||||||
"""Test browse media."""
|
"""Test browse media."""
|
||||||
@ -14,67 +18,9 @@ async def test_async_browse_media(hass):
|
|||||||
|
|
||||||
# Prepare cached Netatmo event date
|
# Prepare cached Netatmo event date
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
hass.data[DOMAIN][DATA_EVENTS] = {
|
hass.data[DOMAIN][DATA_EVENTS] = ast.literal_eval(
|
||||||
"12:34:56:78:90:ab": {
|
load_fixture("netatmo/events.txt")
|
||||||
1599152672: {
|
)
|
||||||
"id": "12345",
|
|
||||||
"type": "person",
|
|
||||||
"time": 1599152672,
|
|
||||||
"camera_id": "12:34:56:78:90:ab",
|
|
||||||
"snapshot": {
|
|
||||||
"url": "https://netatmocameraimage",
|
|
||||||
},
|
|
||||||
"video_id": "98765",
|
|
||||||
"video_status": "available",
|
|
||||||
"message": "<b>Paulus</b> seen",
|
|
||||||
"media_url": "http:///files/high/index.m3u8",
|
|
||||||
},
|
|
||||||
1599152673: {
|
|
||||||
"id": "12346",
|
|
||||||
"type": "person",
|
|
||||||
"time": 1599152673,
|
|
||||||
"camera_id": "12:34:56:78:90:ab",
|
|
||||||
"snapshot": {
|
|
||||||
"url": "https://netatmocameraimage",
|
|
||||||
},
|
|
||||||
"message": "<b>Tobias</b> seen",
|
|
||||||
},
|
|
||||||
1599152674: {
|
|
||||||
"id": "12347",
|
|
||||||
"type": "outdoor",
|
|
||||||
"time": 1599152674,
|
|
||||||
"camera_id": "12:34:56:78:90:ac",
|
|
||||||
"snapshot": {
|
|
||||||
"url": "https://netatmocameraimage",
|
|
||||||
},
|
|
||||||
"video_id": "98766",
|
|
||||||
"video_status": "available",
|
|
||||||
"event_list": [
|
|
||||||
{
|
|
||||||
"type": "vehicle",
|
|
||||||
"time": 1599152674,
|
|
||||||
"id": "12347-0",
|
|
||||||
"offset": 0,
|
|
||||||
"message": "Vehicle detected",
|
|
||||||
"snapshot": {
|
|
||||||
"url": "https://netatmocameraimage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "human",
|
|
||||||
"time": 1599152674,
|
|
||||||
"id": "12347-1",
|
|
||||||
"offset": 8,
|
|
||||||
"message": "Person detected",
|
|
||||||
"snapshot": {
|
|
||||||
"url": "https://netatmocameraimage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"media_url": "http:///files/high/index.m3u8",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hass.data[DOMAIN][DATA_CAMERAS] = {
|
hass.data[DOMAIN][DATA_CAMERAS] = {
|
||||||
"12:34:56:78:90:ab": "MyCamera",
|
"12:34:56:78:90:ab": "MyCamera",
|
||||||
|
61
tests/fixtures/netatmo/events.txt
vendored
Normal file
61
tests/fixtures/netatmo/events.txt
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"12:34:56:78:90:ab": {
|
||||||
|
1599152672: {
|
||||||
|
"id": "12345",
|
||||||
|
"type": "person",
|
||||||
|
"time": 1599152672,
|
||||||
|
"camera_id": "12:34:56:78:90:ab",
|
||||||
|
"snapshot": {
|
||||||
|
"url": "https://netatmocameraimage",
|
||||||
|
},
|
||||||
|
"video_id": "98765",
|
||||||
|
"video_status": "available",
|
||||||
|
"message": "<b>Paulus</b> seen",
|
||||||
|
"media_url": "http:///files/high/index.m3u8",
|
||||||
|
},
|
||||||
|
1599152673: {
|
||||||
|
"id": "12346",
|
||||||
|
"type": "person",
|
||||||
|
"time": 1599152673,
|
||||||
|
"camera_id": "12:34:56:78:90:ab",
|
||||||
|
"snapshot": {
|
||||||
|
"url": "https://netatmocameraimage",
|
||||||
|
},
|
||||||
|
"message": "<b>Tobias</b> seen",
|
||||||
|
},
|
||||||
|
1599152674: {
|
||||||
|
"id": "12347",
|
||||||
|
"type": "outdoor",
|
||||||
|
"time": 1599152674,
|
||||||
|
"camera_id": "12:34:56:78:90:ac",
|
||||||
|
"snapshot": {
|
||||||
|
"url": "https://netatmocameraimage",
|
||||||
|
},
|
||||||
|
"video_id": "98766",
|
||||||
|
"video_status": "available",
|
||||||
|
"event_list": [
|
||||||
|
{
|
||||||
|
"type": "vehicle",
|
||||||
|
"time": 1599152674,
|
||||||
|
"id": "12347-0",
|
||||||
|
"offset": 0,
|
||||||
|
"message": "Vehicle detected",
|
||||||
|
"snapshot": {
|
||||||
|
"url": "https://netatmocameraimage",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "human",
|
||||||
|
"time": 1599152674,
|
||||||
|
"id": "12347-1",
|
||||||
|
"offset": 8,
|
||||||
|
"message": "Person detected",
|
||||||
|
"snapshot": {
|
||||||
|
"url": "https://netatmocameraimage",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"media_url": "http:///files/high/index.m3u8",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user