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:
parent
88b70e964c
commit
9e0ca719ed
7 changed files with 64 additions and 0 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue