added yaml deserializer and move all yamll stuff to one folder

This commit is contained in:
Ari Sosnovsky committed 2021-11-11 11:51:58 -05:00
1 parent a05c1b9dca
commit 2768975f9d
12 files changed
+114 -37

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
from pathlib import Path
from unittest import TestCase
from src.yaml_serializer import dump_yaml, IncludedYaml, SecretValue
class dumping_yamls_tests(TestCase):
def test_dumping_includes(self):
yaml = dump_yaml(
{
"automations": IncludedYaml(
"automations.yaml",
Path("/config/automations.yaml"),
[
{"id": "wow", "alias": "NO!"},
],
)
}
)
self.assertEqual(yaml, "automations: !include automations.yaml\n")
def test_dumping_secrets(self):
yaml = dump_yaml({"google_password": SecretValue("gpass", "supersec")})
self.assertEqual(yaml, "google_password: !secret gpass\n")