Limit dependencies of HA core (#2762)
This commit is contained in:
1 parent
915b9cb3eb
commit
640a8b5a7f
13 files changed
+53
-62
No files matched your search
@@ -37,11 +37,6 @@ class TestHelpersEntity(unittest.TestCase):
|
||||
state = self.hass.states.get(self.entity.entity_id)
|
||||
self.assertTrue(state.attributes.get(ATTR_HIDDEN))
|
||||
|
||||
def test_split_entity_id(self):
|
||||
"""Test split_entity_id."""
|
||||
self.assertEqual(['domain', 'object_id'],
|
||||
entity.split_entity_id('domain.object_id'))
|
||||
|
||||
def test_generate_entity_id_requires_hass_or_ids(self):
|
||||
"""Ensure we require at least hass or current ids."""
|
||||
fmt = 'test.{}'
|
||||
|
||||
+15
-15
@@ -25,6 +25,15 @@ from tests.common import get_test_home_assistant
|
||||
PST = pytz.timezone('America/Los_Angeles')
|
||||
|
||||
|
||||
class TestMethods(unittest.TestCase):
|
||||
"""Test the Home Assistant helper methods."""
|
||||
|
||||
def test_split_entity_id(self):
|
||||
"""Test split_entity_id."""
|
||||
self.assertEqual(['domain', 'object_id'],
|
||||
ha.split_entity_id('domain.object_id'))
|
||||
|
||||
|
||||
class TestHomeAssistant(unittest.TestCase):
|
||||
"""Test the Home Assistant core classes."""
|
||||
|
||||
@@ -442,28 +451,19 @@ class TestConfig(unittest.TestCase):
|
||||
def setUp(self): # pylint: disable=invalid-name
|
||||
"""Setup things to be run when tests are started."""
|
||||
self.config = ha.Config()
|
||||
|
||||
def test_config_dir_set_correct(self):
|
||||
"""Test config dir set correct."""
|
||||
data_dir = os.getenv('APPDATA') if os.name == "nt" \
|
||||
else os.path.expanduser('~')
|
||||
self.assertEqual(os.path.join(data_dir, ".homeassistant"),
|
||||
self.config.config_dir)
|
||||
self.assertIsNone(self.config.config_dir)
|
||||
|
||||
def test_path_with_file(self):
|
||||
"""Test get_config_path method."""
|
||||
data_dir = os.getenv('APPDATA') if os.name == "nt" \
|
||||
else os.path.expanduser('~')
|
||||
self.assertEqual(os.path.join(data_dir, ".homeassistant", "test.conf"),
|
||||
self.config.config_dir = '/tmp/ha-config'
|
||||
self.assertEqual("/tmp/ha-config/test.conf",
|
||||
self.config.path("test.conf"))
|
||||
|
||||
def test_path_with_dir_and_file(self):
|
||||
"""Test get_config_path method."""
|
||||
data_dir = os.getenv('APPDATA') if os.name == "nt" \
|
||||
else os.path.expanduser('~')
|
||||
self.assertEqual(
|
||||
os.path.join(data_dir, ".homeassistant", "dir", "test.conf"),
|
||||
self.config.path("dir", "test.conf"))
|
||||
self.config.config_dir = '/tmp/ha-config'
|
||||
self.assertEqual("/tmp/ha-config/dir/test.conf",
|
||||
self.config.path("dir", "test.conf"))
|
||||
|
||||
def test_as_dict(self):
|
||||
"""Test as dict."""
|
||||
|
||||
@@ -10,7 +10,8 @@ import homeassistant.components.http as http
|
||||
from homeassistant.const import HTTP_HEADER_HA_AUTH, EVENT_STATE_CHANGED
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import get_test_instance_port, get_test_home_assistant
|
||||
from tests.common import (
|
||||
get_test_instance_port, get_test_home_assistant, get_test_config_dir)
|
||||
|
||||
API_PASSWORD = "test1234"
|
||||
MASTER_PORT = get_test_instance_port()
|
||||
@@ -52,6 +53,7 @@ def setUpModule(): # pylint: disable=invalid-name
|
||||
|
||||
# Start slave
|
||||
slave = remote.HomeAssistant(master_api)
|
||||
slave.config.config_dir = get_test_config_dir()
|
||||
bootstrap.setup_component(
|
||||
slave, http.DOMAIN,
|
||||
{http.DOMAIN: {http.CONF_API_PASSWORD: API_PASSWORD,
|
||||
|
||||
Reference in new issue
Block a user