Fix canary flaky test (#11519)

pull/11636/head
Paulus Schoutsen 2018-01-07 15:05:19 -08:00 committed by GitHub
parent 8267a21bfe
commit bccd880395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -1,10 +1,9 @@
"""The tests for the Canary sensor platform."""
import copy
import unittest
from unittest.mock import patch, Mock
from unittest.mock import Mock
from canary.api import SensorType
from homeassistant.components import canary as base_canary
from homeassistant.components.canary import DATA_CANARY
from homeassistant.components.sensor import canary
from homeassistant.components.sensor.canary import CanarySensor
@ -39,16 +38,13 @@ class TestCanarySensorSetup(unittest.TestCase):
"""Stop everything that was started."""
self.hass.stop()
@patch('homeassistant.components.canary.CanaryData')
def test_setup_sensors(self, mock_canary):
def test_setup_sensors(self):
"""Test the sensor setup."""
base_canary.setup(self.hass, self.config)
online_device_at_home = mock_device(20, "Dining Room", True)
offline_device_at_home = mock_device(21, "Front Yard", False)
online_device_at_work = mock_device(22, "Office", True)
self.hass.data[DATA_CANARY] = mock_canary()
self.hass.data[DATA_CANARY] = Mock()
self.hass.data[DATA_CANARY].locations = [
mock_location("Home", True, devices=[online_device_at_home,
offline_device_at_home]),