mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Deprecate explicit entity_id in template platforms (#11123)
* Deprecate explicit entity_id in template platforms * Use config validator for deprecation * Fix copy/paste typos * Also print the config value * Add test for config validator * Assert the module name that logged the message
This commit is contained in:
committed by
Paulus Schoutsen
parent
88b70e964c
commit
9e0ca719ed
@@ -441,6 +441,27 @@ def test_datetime():
|
||||
schema('2016-11-23T18:59:08')
|
||||
|
||||
|
||||
def test_deprecated(caplog):
|
||||
"""Test deprecation log."""
|
||||
schema = vol.Schema({
|
||||
'venus': cv.boolean,
|
||||
'mars': cv.boolean
|
||||
})
|
||||
deprecated_schema = vol.All(
|
||||
cv.deprecated('mars'),
|
||||
schema
|
||||
)
|
||||
|
||||
deprecated_schema({'venus': True})
|
||||
assert len(caplog.records) == 0
|
||||
|
||||
deprecated_schema({'mars': True})
|
||||
assert len(caplog.records) == 1
|
||||
assert caplog.records[0].name == __name__
|
||||
assert ("The 'mars' option (with value 'True') is deprecated, "
|
||||
"please remove it from your configuration.") in caplog.text
|
||||
|
||||
|
||||
def test_key_dependency():
|
||||
"""Test key_dependency validator."""
|
||||
schema = vol.Schema(cv.key_dependency('beer', 'soda'))
|
||||
|
||||
Reference in New Issue
Block a user