OwnTrack Async (#6363)

* Migrate owntrack to async

* fix tests
This commit is contained in:
Pascal Vizeli authored and GitHub committed 2017-03-03 09:23:58 +01:00
1 parent aa17481c94
commit 3e70154695
2 files changed
+117 -91

No files matched your search

@@ -1,4 +1,5 @@
"""The tests for the Owntracks device tracker."""
import asyncio
import json
import os
import unittest
@@ -12,6 +13,7 @@ import homeassistant.components.device_tracker.owntracks as owntracks
from homeassistant.bootstrap import setup_component
from homeassistant.components import device_tracker
from homeassistant.const import CONF_PLATFORM, STATE_NOT_HOME
from homeassistant.util.async import run_coroutine_threadsafe
USER = 'greg'
DEVICE = 'phone'
@@ -640,6 +642,7 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
def test_waypoint_import_no_whitelist(self):
"""Test import of list of waypoints with no whitelist set."""
@asyncio.coroutine
def mock_see(**kwargs):
"""Fake see method for owntracks."""
return
@@ -649,7 +652,8 @@ class TestDeviceTrackerOwnTracks(BaseMQTT):
CONF_MAX_GPS_ACCURACY: 200,
CONF_WAYPOINT_IMPORT: True
}
owntracks.setup_scanner(self.hass, test_config, mock_see)
run_coroutine_threadsafe(owntracks.async_setup_scanner(
self.hass, test_config, mock_see), self.hass.loop).result()
waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy()
self.send_message(WAYPOINT_TOPIC_BLOCKED, waypoints_message)
# Check if it made it into states