generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate zone_id's, check for duplicates & orphans
- Loading branch information
Showing
4 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
default_config: | ||
|
||
irrigation_unlimited: | ||
controllers: | ||
zones: | ||
- name: "Zone 1" | ||
- name: "Zone 2" | ||
zone_id: "1" | ||
- name: "Zone 3" | ||
zone_id: "zone_3" | ||
- name: "Zone 4" | ||
zone_id: "zone_3" | ||
- name: "Zone 5" | ||
zone_id: "ABC" | ||
sequences: | ||
- name: "Sequence 1" | ||
schedules: | ||
- name: Never | ||
time: "21:00" | ||
month: [feb] | ||
day: [31] | ||
zones: | ||
- zone_id: 1 | ||
- zone_id: [1, "no_zone"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""irrigation_unlimited test for logging""" | ||
# pylint: disable=unused-import | ||
from unittest.mock import patch | ||
import homeassistant.core as ha | ||
from custom_components.irrigation_unlimited.irrigation_unlimited import ( | ||
IULogger, | ||
) | ||
from tests.iu_test_support import IUExam | ||
|
||
IUExam.quiet_mode() | ||
|
||
|
||
async def test_link_ids(hass: ha.HomeAssistant, skip_dependencies, skip_history): | ||
"""Test invalid, duplicate and orphaned ids.""" | ||
# pylint: disable=unused-argument | ||
|
||
with patch.object(IULogger, "log_duplicate_id") as mock_duplicate: | ||
with patch.object(IULogger, "log_invalid_id") as mock_invalid: | ||
with patch.object(IULogger, "log_orphan_id") as mock_orphan: | ||
async with IUExam(hass, "test_ids.yaml"): | ||
assert mock_duplicate.call_count == 2 | ||
assert mock_invalid.call_count == 1 | ||
assert mock_orphan.call_count == 1 |