From 3aad35fbceabeddacf3b3858661b89719467b63e Mon Sep 17 00:00:00 2001 From: Ari Date: Thu, 1 Sep 2022 17:25:56 -0400 Subject: [PATCH] fixed up linting --- api/src/automations/manager.py | 4 ++++ api/tests/unittests/automations/test_loader.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/automations/manager.py b/api/src/automations/manager.py index 9f04ced..8f16d26 100644 --- a/api/src/automations/manager.py +++ b/api/src/automations/manager.py @@ -84,6 +84,8 @@ class AutomationManager: ) def update(self, automation: ExtenededAutomation, create_if_not_found: bool = False): + if automation.id is None: + raise AssertionError("automation.id must be defined to update!") automation_path = self.hass_config.root_path / automation.source_file if not automation_path.parent.exists(): automation_path.parent.mkdir(parents=True) @@ -150,6 +152,8 @@ class AutomationManager: self.tag_manager.save(self.tag_path) def delete(self, automation: ExtenededAutomation): + if automation.id is None: + raise AssertionError("automation.id must be defined to update!") automation_path = self.hass_config.root_path / automation.source_file if automation.source_file_type == "obj": automation_path.unlink(missing_ok=True) diff --git a/api/tests/unittests/automations/test_loader.py b/api/tests/unittests/automations/test_loader.py index 7f8fbcf..e6e5994 100644 --- a/api/tests/unittests/automations/test_loader.py +++ b/api/tests/unittests/automations/test_loader.py @@ -10,7 +10,6 @@ from src.automations.tags import TagManager from src.automations.types import ExtenededAutomation from src.hass_config.loader import HassConfig from tests.utils import ( - HA_CONFIG13_EXAMPLE, HA_CONFIG2_EXAMPLE, HA_CONFIG3_EXAMPLE, HA_CONFIG4_EXAMPLE, @@ -22,6 +21,7 @@ from tests.utils import ( HA_CONFIG10_EXAMPLE, HA_CONFIG11_EXAMPLE, HA_CONFIG12_EXAMPLE, + HA_CONFIG13_EXAMPLE, HA_CONFIG_EXAMPLE, )