mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Avoid misuse sanitize_path, clarify docs (#45469)
This commit is contained in:
@@ -11,17 +11,17 @@ import homeassistant.util.dt as dt_util
|
||||
def test_sanitize_filename():
|
||||
"""Test sanitize_filename."""
|
||||
assert util.sanitize_filename("test") == "test"
|
||||
assert util.sanitize_filename("/test") == "test"
|
||||
assert util.sanitize_filename("..test") == "test"
|
||||
assert util.sanitize_filename("\\test") == "test"
|
||||
assert util.sanitize_filename("\\../test") == "test"
|
||||
assert util.sanitize_filename("/test") == ""
|
||||
assert util.sanitize_filename("..test") == ""
|
||||
assert util.sanitize_filename("\\test") == ""
|
||||
assert util.sanitize_filename("\\../test") == ""
|
||||
|
||||
|
||||
def test_sanitize_path():
|
||||
"""Test sanitize_path."""
|
||||
assert util.sanitize_path("test/path") == "test/path"
|
||||
assert util.sanitize_path("~test/path") == "test/path"
|
||||
assert util.sanitize_path("~/../test/path") == "//test/path"
|
||||
assert util.sanitize_path("~test/path") == ""
|
||||
assert util.sanitize_path("~/../test/path") == ""
|
||||
|
||||
|
||||
def test_slugify():
|
||||
|
||||
Reference in New Issue
Block a user