mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Updated core config directory tests
This commit is contained in:
parent
f5b98c86f0
commit
bfa3900e6a
@ -16,6 +16,8 @@ from datetime import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
import homeassistant.core as ha
|
import homeassistant.core as ha
|
||||||
|
from homeassistant.exceptions import (
|
||||||
|
HomeAssistantError, InvalidEntityFormatError)
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.helpers.event import track_state_change
|
from homeassistant.helpers.event import track_state_change
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -41,7 +43,7 @@ class TestHomeAssistant(unittest.TestCase):
|
|||||||
""" Stop down stuff we started. """
|
""" Stop down stuff we started. """
|
||||||
try:
|
try:
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
except ha.HomeAssistantError:
|
except HomeAssistantError:
|
||||||
# Already stopped after the block till stopped test
|
# Already stopped after the block till stopped test
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ class TestState(unittest.TestCase):
|
|||||||
def test_init(self):
|
def test_init(self):
|
||||||
""" Test state.init """
|
""" Test state.init """
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
ha.InvalidEntityFormatError, ha.State,
|
InvalidEntityFormatError, ha.State,
|
||||||
'invalid_entity_format', 'test_state')
|
'invalid_entity_format', 'test_state')
|
||||||
|
|
||||||
def test_domain(self):
|
def test_domain(self):
|
||||||
@ -489,18 +491,24 @@ class TestConfig(unittest.TestCase):
|
|||||||
|
|
||||||
def test_config_dir_set_correct(self):
|
def test_config_dir_set_correct(self):
|
||||||
""" Test config dir set correct. """
|
""" Test config dir set correct. """
|
||||||
self.assertEqual(os.path.join(os.getcwd(), "config"),
|
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.config.config_dir)
|
||||||
|
|
||||||
def test_path_with_file(self):
|
def test_path_with_file(self):
|
||||||
""" Test get_config_path method. """
|
""" Test get_config_path method. """
|
||||||
self.assertEqual(os.path.join(os.getcwd(), "config", "test.conf"),
|
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.path("test.conf"))
|
self.config.path("test.conf"))
|
||||||
|
|
||||||
def test_path_with_dir_and_file(self):
|
def test_path_with_dir_and_file(self):
|
||||||
""" Test get_config_path method. """
|
""" Test get_config_path method. """
|
||||||
|
data_dir = os.getenv('APPDATA') if os.name == "nt" \
|
||||||
|
else os.path.expanduser('~')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
os.path.join(os.getcwd(), "config", "dir", "test.conf"),
|
os.path.join(data_dir, ".homeassistant", "dir", "test.conf"),
|
||||||
self.config.path("dir", "test.conf"))
|
self.config.path("dir", "test.conf"))
|
||||||
|
|
||||||
def test_temperature_not_convert_if_no_preference(self):
|
def test_temperature_not_convert_if_no_preference(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user