mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Update hassbian component with real output (#5989)
This commit is contained in:
parent
4b8e6e36b6
commit
409b74b780
@ -8,42 +8,26 @@ from homeassistant.components.http import HomeAssistantView
|
|||||||
|
|
||||||
_TEST_OUTPUT = """
|
_TEST_OUTPUT = """
|
||||||
{
|
{
|
||||||
"suites": [
|
"suites":{
|
||||||
{
|
"libcec":{
|
||||||
"openzwave": [
|
"state":"Uninstalled",
|
||||||
{
|
"description":"Installs the libcec package for controlling CEC devices from this Pi"
|
||||||
"state": "installed"
|
|
||||||
},
|
},
|
||||||
{
|
"mosquitto":{
|
||||||
"description": "This is the description of the Open Z-Wave suite."
|
"state":"failed",
|
||||||
|
"description":"Installs the Mosquitto package for setting up a local MQTT server"
|
||||||
|
},
|
||||||
|
"openzwave":{
|
||||||
|
"state":"Uninstalled",
|
||||||
|
"description":"Installs the Open Z-wave package for setting up your zwave network"
|
||||||
|
},
|
||||||
|
"samba":{
|
||||||
|
"state":"installing",
|
||||||
|
"description":"Installs the samba package for sharing the hassbian configuration files over the Pi's network."
|
||||||
}
|
}
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"openelec": [
|
|
||||||
{
|
|
||||||
"state": "not_installed"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description":
|
|
||||||
"OpenElec is amazing. It allows you to control the TV."
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mosquitto": [
|
|
||||||
{
|
|
||||||
"state": "installing"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description":
|
|
||||||
"Mosquitto is an MQTT broker."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
"""
|
""" # noqa
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
@ -87,18 +71,7 @@ class HassbianSuitesView(HomeAssistantView):
|
|||||||
"""Request suite status."""
|
"""Request suite status."""
|
||||||
inp = yield from hassbian_status(request.app['hass'], self._test_mode)
|
inp = yield from hassbian_status(request.app['hass'], self._test_mode)
|
||||||
|
|
||||||
# Flatten the structure a bit
|
return self.json(inp['suites'])
|
||||||
suites = {}
|
|
||||||
|
|
||||||
for suite in inp['suites']:
|
|
||||||
key = next(iter(suite))
|
|
||||||
info = suites[key] = {}
|
|
||||||
|
|
||||||
for item in suite[key]:
|
|
||||||
item_key = next(iter(item))
|
|
||||||
info[item_key] = item[item_key]
|
|
||||||
|
|
||||||
return self.json(suites)
|
|
||||||
|
|
||||||
|
|
||||||
class HassbianSuiteInstallView(HomeAssistantView):
|
class HassbianSuiteInstallView(HomeAssistantView):
|
||||||
|
@ -51,8 +51,9 @@ def test_get_suites(hass, test_client):
|
|||||||
|
|
||||||
assert 'mosquitto' in result
|
assert 'mosquitto' in result
|
||||||
info = result['mosquitto']
|
info = result['mosquitto']
|
||||||
assert info['state'] == 'installing'
|
assert info['state'] == 'failed'
|
||||||
assert info['description'] == 'Mosquitto is an MQTT broker.'
|
assert info['description'] == \
|
||||||
|
'Installs the Mosquitto package for setting up a local MQTT server'
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user