Add check for HTML in translations (#35615)

* Add check for HTML in translations

and remove existing html

* Add test
This commit is contained in:
Bram Kragten authored and GitHub committed 2020-05-14 19:33:14 +02:00
1 parent a42a654590
commit cb7b8d94c0
7 files changed
+47 -18

No files matched your search

+20
View File
@@ -351,6 +351,26 @@ def test_string():
schema(value)
def test_string_with_no_html():
"""Test string with no html validation."""
schema = vol.Schema(cv.string_with_no_html)
with pytest.raises(vol.Invalid):
schema("This has HTML in it <a>Link</a>")
with pytest.raises(vol.Invalid):
schema("<b>Bold</b>")
for value in (
True,
3,
"Hello",
"**Hello**",
"This has no HTML [Link](https://home-assistant.io)",
):
schema(value)
def test_temperature_unit():
"""Test temperature unit validation."""
schema = vol.Schema(cv.temperature_unit)