Test function for mqtt topic validators and IsFile() linting fix (#1740)

* Add test function for mqtt topic validators.
* Fix for linting error on vol.IsFile()
This commit is contained in:
Jan Harkes 2016-04-07 13:52:25 -04:00
parent 7d9b13a6a2
commit 5b17f629ad
3 changed files with 12 additions and 1 deletions

View file

@ -34,6 +34,11 @@ def boolean(value):
return bool(value)
def isfile(value):
"""Validate that the value is an existing file."""
return vol.IsFile('not a file')(value)
def ensure_list(value):
"""Wrap value in list if it is not one."""
return value if isinstance(value, list) else [value]