Disable location queries
This commit is contained in:
parent
077797ac4f
commit
61630783f1
3 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,11 @@
|
||||||
import betamax
|
import betamax
|
||||||
|
|
||||||
|
from homeassistant.util import location
|
||||||
|
|
||||||
|
from .common import mock_detect_location_info
|
||||||
|
|
||||||
with betamax.Betamax.configure() as config:
|
with betamax.Betamax.configure() as config:
|
||||||
config.cassette_library_dir = 'tests/cassettes'
|
config.cassette_library_dir = 'tests/cassettes'
|
||||||
|
|
||||||
|
# This hits a 3rd party server. Always mock it.
|
||||||
|
location.detect_location_info = mock_detect_location_info
|
||||||
|
|
|
@ -8,7 +8,6 @@ Tests bootstrap.
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from homeassistant import core, bootstrap
|
from homeassistant import core, bootstrap
|
||||||
from homeassistant.const import (__version__, CONF_LATITUDE, CONF_LONGITUDE,
|
from homeassistant.const import (__version__, CONF_LATITUDE, CONF_LONGITUDE,
|
||||||
|
@ -16,8 +15,6 @@ from homeassistant.const import (__version__, CONF_LATITUDE, CONF_LONGITUDE,
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
from tests.common import mock_detect_location_info
|
|
||||||
|
|
||||||
|
|
||||||
class TestBootstrap(unittest.TestCase):
|
class TestBootstrap(unittest.TestCase):
|
||||||
""" Test the bootstrap utils. """
|
""" Test the bootstrap utils. """
|
||||||
|
@ -35,9 +32,7 @@ class TestBootstrap(unittest.TestCase):
|
||||||
fp.write('{}:\n'.format(comp).encode('utf-8'))
|
fp.write('{}:\n'.format(comp).encode('utf-8'))
|
||||||
fp.flush()
|
fp.flush()
|
||||||
|
|
||||||
with mock.patch('homeassistant.util.location.detect_location_info',
|
hass = bootstrap.from_config_file(fp.name)
|
||||||
mock_detect_location_info):
|
|
||||||
hass = bootstrap.from_config_file(fp.name)
|
|
||||||
|
|
||||||
components.append('group')
|
components.append('group')
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
||||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
|
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
|
||||||
CONF_TIME_ZONE)
|
CONF_TIME_ZONE)
|
||||||
|
|
||||||
from tests.common import get_test_config_dir, mock_detect_location_info
|
from tests.common import get_test_config_dir
|
||||||
|
|
||||||
CONFIG_DIR = get_test_config_dir()
|
CONFIG_DIR = get_test_config_dir()
|
||||||
YAML_PATH = os.path.join(CONFIG_DIR, config_util.YAML_CONFIG_FILE)
|
YAML_PATH = os.path.join(CONFIG_DIR, config_util.YAML_CONFIG_FILE)
|
||||||
|
@ -112,8 +112,6 @@ class TestConfig(unittest.TestCase):
|
||||||
[('hello', 0), ('world', 1)],
|
[('hello', 0), ('world', 1)],
|
||||||
list(config_util.load_yaml_config_file(YAML_PATH).items()))
|
list(config_util.load_yaml_config_file(YAML_PATH).items()))
|
||||||
|
|
||||||
@mock.patch('homeassistant.util.location.detect_location_info',
|
|
||||||
mock_detect_location_info)
|
|
||||||
@mock.patch('builtins.print')
|
@mock.patch('builtins.print')
|
||||||
def test_create_default_config_detect_location(self, mock_print):
|
def test_create_default_config_detect_location(self, mock_print):
|
||||||
""" Test that detect location sets the correct config keys. """
|
""" Test that detect location sets the correct config keys. """
|
||||||
|
|
Loading…
Add table
Reference in a new issue