Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -21,81 +21,78 @@ class TestPanelIframe(unittest.TestCase):
|
||||
def test_wrong_config(self):
|
||||
"""Test setup with wrong configuration."""
|
||||
to_try = [
|
||||
{'invalid space': {
|
||||
'url': 'https://home-assistant.io'}},
|
||||
{'router': {
|
||||
'url': 'not-a-url'}}]
|
||||
{"invalid space": {"url": "https://home-assistant.io"}},
|
||||
{"router": {"url": "not-a-url"}},
|
||||
]
|
||||
|
||||
for conf in to_try:
|
||||
assert not setup.setup_component(
|
||||
self.hass, 'panel_iframe', {
|
||||
'panel_iframe': conf
|
||||
})
|
||||
self.hass, "panel_iframe", {"panel_iframe": conf}
|
||||
)
|
||||
|
||||
def test_correct_config(self):
|
||||
"""Test correct config."""
|
||||
assert setup.setup_component(
|
||||
self.hass, 'panel_iframe', {
|
||||
'panel_iframe': {
|
||||
'router': {
|
||||
'icon': 'mdi:network-wireless',
|
||||
'title': 'Router',
|
||||
'url': 'http://192.168.1.1',
|
||||
'require_admin': True,
|
||||
self.hass,
|
||||
"panel_iframe",
|
||||
{
|
||||
"panel_iframe": {
|
||||
"router": {
|
||||
"icon": "mdi:network-wireless",
|
||||
"title": "Router",
|
||||
"url": "http://192.168.1.1",
|
||||
"require_admin": True,
|
||||
},
|
||||
'weather': {
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'Weather',
|
||||
'url': 'https://www.wunderground.com/us/ca/san-diego',
|
||||
'require_admin': True,
|
||||
"weather": {
|
||||
"icon": "mdi:weather",
|
||||
"title": "Weather",
|
||||
"url": "https://www.wunderground.com/us/ca/san-diego",
|
||||
"require_admin": True,
|
||||
},
|
||||
'api': {
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'Api',
|
||||
'url': '/api',
|
||||
"api": {"icon": "mdi:weather", "title": "Api", "url": "/api"},
|
||||
"ftp": {
|
||||
"icon": "mdi:weather",
|
||||
"title": "FTP",
|
||||
"url": "ftp://some/ftp",
|
||||
},
|
||||
'ftp': {
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'FTP',
|
||||
'url': 'ftp://some/ftp',
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
panels = self.hass.data[frontend.DATA_PANELS]
|
||||
|
||||
assert panels.get('router').to_response() == {
|
||||
'component_name': 'iframe',
|
||||
'config': {'url': 'http://192.168.1.1'},
|
||||
'icon': 'mdi:network-wireless',
|
||||
'title': 'Router',
|
||||
'url_path': 'router',
|
||||
'require_admin': True,
|
||||
assert panels.get("router").to_response() == {
|
||||
"component_name": "iframe",
|
||||
"config": {"url": "http://192.168.1.1"},
|
||||
"icon": "mdi:network-wireless",
|
||||
"title": "Router",
|
||||
"url_path": "router",
|
||||
"require_admin": True,
|
||||
}
|
||||
|
||||
assert panels.get('weather').to_response() == {
|
||||
'component_name': 'iframe',
|
||||
'config': {'url': 'https://www.wunderground.com/us/ca/san-diego'},
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'Weather',
|
||||
'url_path': 'weather',
|
||||
'require_admin': True,
|
||||
assert panels.get("weather").to_response() == {
|
||||
"component_name": "iframe",
|
||||
"config": {"url": "https://www.wunderground.com/us/ca/san-diego"},
|
||||
"icon": "mdi:weather",
|
||||
"title": "Weather",
|
||||
"url_path": "weather",
|
||||
"require_admin": True,
|
||||
}
|
||||
|
||||
assert panels.get('api').to_response() == {
|
||||
'component_name': 'iframe',
|
||||
'config': {'url': '/api'},
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'Api',
|
||||
'url_path': 'api',
|
||||
'require_admin': False,
|
||||
assert panels.get("api").to_response() == {
|
||||
"component_name": "iframe",
|
||||
"config": {"url": "/api"},
|
||||
"icon": "mdi:weather",
|
||||
"title": "Api",
|
||||
"url_path": "api",
|
||||
"require_admin": False,
|
||||
}
|
||||
|
||||
assert panels.get('ftp').to_response() == {
|
||||
'component_name': 'iframe',
|
||||
'config': {'url': 'ftp://some/ftp'},
|
||||
'icon': 'mdi:weather',
|
||||
'title': 'FTP',
|
||||
'url_path': 'ftp',
|
||||
'require_admin': False,
|
||||
assert panels.get("ftp").to_response() == {
|
||||
"component_name": "iframe",
|
||||
"config": {"url": "ftp://some/ftp"},
|
||||
"icon": "mdi:weather",
|
||||
"title": "FTP",
|
||||
"url_path": "ftp",
|
||||
"require_admin": False,
|
||||
}
|
||||
Reference in new issue
Block a user