Add case insensitive testing to boolean string validation.

This commit is contained in:
Jan Harkes authored and Paulus Schoutsen committed 2016-04-03 21:38:58 -07:00
1 parent eb415d7b96
commit cbe9a7d2a3
2 files changed
+16

No files matched your search

+15
View File
@@ -4,6 +4,21 @@ import voluptuous as vol
import homeassistant.helpers.config_validation as cv
def test_boolean():
"""Test boolean validation."""
schema = vol.Schema(cv.boolean)
for value in ('T', 'negative', 'lock'):
with pytest.raises(vol.MultipleInvalid):
schema(value)
for value in ('true', 'On', '1', 'YES', 'enable', 1, True):
assert schema(value)
for value in ('false', 'Off', '0', 'NO', 'disable', 0, False):
assert not schema(value)
def test_latitude():
"""Test latitude validation."""
schema = vol.Schema(cv.latitude)