UniFi - Bandwidth sensors (#27229)

* First draft of UniFi bandwidth sensors

* Clean up

* Add tests for sensors
This commit is contained in:
Robert Svensson authored and Paulus Schoutsen committed 2019-10-06 08:17:40 -07:00
1 parent 6cc71db385
commit c7c88b2b68
10 files changed
+444 -12

No files matched your search

+13 -3
View File
@@ -67,12 +67,18 @@ async def test_controller_setup():
assert await unifi_controller.async_setup() is True
assert unifi_controller.api is api
assert len(hass.config_entries.async_forward_entry_setup.mock_calls) == 2
assert len(hass.config_entries.async_forward_entry_setup.mock_calls) == len(
controller.SUPPORTED_PLATFORMS
)
assert hass.config_entries.async_forward_entry_setup.mock_calls[0][1] == (
entry,
"device_tracker",
)
assert hass.config_entries.async_forward_entry_setup.mock_calls[1][1] == (
entry,
"sensor",
)
assert hass.config_entries.async_forward_entry_setup.mock_calls[2][1] == (
entry,
"switch",
)
@@ -214,12 +220,16 @@ async def test_reset_unloads_entry_if_setup():
with patch.object(controller, "get_controller", return_value=mock_coro(api)):
assert await unifi_controller.async_setup() is True
assert len(hass.config_entries.async_forward_entry_setup.mock_calls) == 2
assert len(hass.config_entries.async_forward_entry_setup.mock_calls) == len(
controller.SUPPORTED_PLATFORMS
)
hass.config_entries.async_forward_entry_unload.return_value = mock_coro(True)
assert await unifi_controller.async_reset()
assert len(hass.config_entries.async_forward_entry_unload.mock_calls) == 2
assert len(hass.config_entries.async_forward_entry_unload.mock_calls) == len(
controller.SUPPORTED_PLATFORMS
)
async def test_get_controller(hass):