mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Merge pull request #1097 from molobrakos/add-test
add test for unsafe yaml
This commit is contained in:
commit
35613d7fbf
@ -94,6 +94,15 @@ class TestConfig(unittest.TestCase):
|
||||
with self.assertRaises(HomeAssistantError):
|
||||
config_util.load_yaml_config_file(YAML_PATH)
|
||||
|
||||
def test_load_yaml_config_raises_error_if_unsafe_yaml(self):
|
||||
""" Test error raised if unsafe YAML. """
|
||||
with open(YAML_PATH, 'w') as f:
|
||||
f.write('hello: !!python/object/apply:os.system')
|
||||
|
||||
with self.assertRaises(HomeAssistantError):
|
||||
config_util.load_yaml_config_file(YAML_PATH)
|
||||
|
||||
|
||||
def test_load_yaml_config_preserves_key_order(self):
|
||||
with open(YAML_PATH, 'w') as f:
|
||||
f.write('hello: 0\n')
|
||||
|
Loading…
x
Reference in New Issue
Block a user