From 409b74b780c40e96a0e32b02e92489b109ec9014 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 14 Feb 2017 09:34:17 -0800 Subject: [PATCH] Update hassbian component with real output (#5989) --- homeassistant/components/config/hassbian.py | 57 ++++++--------------- tests/components/config/test_hassbian.py | 5 +- 2 files changed, 18 insertions(+), 44 deletions(-) diff --git a/homeassistant/components/config/hassbian.py b/homeassistant/components/config/hassbian.py index c90583c5278..e94d6d25b90 100644 --- a/homeassistant/components/config/hassbian.py +++ b/homeassistant/components/config/hassbian.py @@ -8,42 +8,26 @@ from homeassistant.components.http import HomeAssistantView _TEST_OUTPUT = """ { - "suites": [ - { - "openzwave": [ - { - "state": "installed" + "suites":{ + "libcec":{ + "state":"Uninstalled", + "description":"Installs the libcec package for controlling CEC devices from this Pi" }, - { - "description": "This is the description of the Open Z-Wave suite." - } - ] - }, - { - "openelec": [ - { - "state": "not_installed" + "mosquitto":{ + "state":"failed", + "description":"Installs the Mosquitto package for setting up a local MQTT server" }, - { - "description": - "OpenElec is amazing. It allows you to control the TV." - } - ] - }, - { - "mosquitto": [ - { - "state": "installing" + "openzwave":{ + "state":"Uninstalled", + "description":"Installs the Open Z-wave package for setting up your zwave network" }, - { - "description": - "Mosquitto is an MQTT broker." + "samba":{ + "state":"installing", + "description":"Installs the samba package for sharing the hassbian configuration files over the Pi's network." } - ] } - ] } -""" +""" # noqa @asyncio.coroutine @@ -87,18 +71,7 @@ class HassbianSuitesView(HomeAssistantView): """Request suite status.""" inp = yield from hassbian_status(request.app['hass'], self._test_mode) - # Flatten the structure a bit - 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) + return self.json(inp['suites']) class HassbianSuiteInstallView(HomeAssistantView): diff --git a/tests/components/config/test_hassbian.py b/tests/components/config/test_hassbian.py index 811a8add3e2..b30ba6b71a6 100644 --- a/tests/components/config/test_hassbian.py +++ b/tests/components/config/test_hassbian.py @@ -51,8 +51,9 @@ def test_get_suites(hass, test_client): assert 'mosquitto' in result info = result['mosquitto'] - assert info['state'] == 'installing' - assert info['description'] == 'Mosquitto is an MQTT broker.' + assert info['state'] == 'failed' + assert info['description'] == \ + 'Installs the Mosquitto package for setting up a local MQTT server' @asyncio.coroutine