tags
This commit is contained in:
1 parent
02cbacabe0
commit
f8b59c6b17
7 files changed
+71
-56
No files matched your search
@@ -6,6 +6,7 @@ from src.automations_v2.loader import (
|
||||
extract_automation_paths,
|
||||
load_automation_path,
|
||||
)
|
||||
from src.automations_v2.tags import TagManager
|
||||
from src.automations_v2.types import ExtenededAutomation
|
||||
from src.hass_config.loader import HassConfig
|
||||
from tests.utils import (
|
||||
@@ -22,7 +23,9 @@ class loader_tests(TestCase):
|
||||
def test_load_automation_list_file(self):
|
||||
automations = list(
|
||||
load_automation_path(
|
||||
HA_CONFIG2_EXAMPLE / "automations.yaml", configuration_key="automation"
|
||||
HA_CONFIG2_EXAMPLE / "automations.yaml",
|
||||
configuration_key="automation",
|
||||
tag_manager=TagManager({"type": "routine"}),
|
||||
)
|
||||
)
|
||||
self.assertEqual(len(automations), 1)
|
||||
@@ -36,6 +39,7 @@ class loader_tests(TestCase):
|
||||
alias="Climate - Pref temperature ",
|
||||
description="",
|
||||
mode="single",
|
||||
tags={"type": "routine"},
|
||||
trigger=[
|
||||
{
|
||||
"platform": "state",
|
||||
@@ -64,6 +68,7 @@ class loader_tests(TestCase):
|
||||
load_automation_path(
|
||||
HA_CONFIG4_EXAMPLE / "automations" / "notify_washer.yaml",
|
||||
configuration_key="automation base",
|
||||
tag_manager=TagManager({"1659114647067": {"room": "laundry"}}),
|
||||
)
|
||||
)
|
||||
self.assertEqual(len(automations), 1)
|
||||
@@ -77,6 +82,7 @@ class loader_tests(TestCase):
|
||||
alias="Notify Washer",
|
||||
description="Example",
|
||||
mode="single",
|
||||
tags={"room": "laundry"},
|
||||
trigger=[
|
||||
{
|
||||
"platform": "homeassistant",
|
||||
@@ -97,13 +103,25 @@ class loader_tests(TestCase):
|
||||
def test_load_automation_empty_file(self):
|
||||
file_path = Path(mktemp())
|
||||
file_path.touch()
|
||||
automations = list(load_automation_path(file_path, configuration_key="automation ui"))
|
||||
automations = list(
|
||||
load_automation_path(
|
||||
file_path,
|
||||
configuration_key="automation ui",
|
||||
tag_manager=TagManager(),
|
||||
)
|
||||
)
|
||||
self.assertEqual(len(automations), 0)
|
||||
|
||||
def test_load_automation_none_existing_file(self):
|
||||
file_path = Path(mktemp())
|
||||
file_path.unlink(missing_ok=True)
|
||||
automations = list(load_automation_path(file_path, configuration_key="automation manual"))
|
||||
automations = list(
|
||||
load_automation_path(
|
||||
file_path,
|
||||
configuration_key="automation manual",
|
||||
tag_manager=TagManager(),
|
||||
)
|
||||
)
|
||||
self.assertEqual(len(automations), 0)
|
||||
|
||||
def test_extract_all_automation_files(self):
|
||||
|
||||
Reference in new issue
Block a user