fixed up tests
This commit is contained in:
1 parent
2d80798ccb
commit
f62f139f55
3 files changed
+3
-34
No files matched your search
@@ -34,10 +34,6 @@ omit = ["./venv/*", "tests/*"]
|
||||
module = "decouple.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "ruamel.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "tests.*"
|
||||
ignore_missing_imports = true
|
||||
@@ -1,7 +1,6 @@
|
||||
import yaml
|
||||
from unittest import TestCase
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from src.api.app import make_app
|
||||
from src.automations.types import (
|
||||
@@ -151,7 +150,7 @@ class automation_update_tests(BaseTestCase):
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
with (self.config_folder / "automations.yaml").open("r") as fp:
|
||||
disk_data = dict(YAML().load(fp)[15])
|
||||
disk_data = dict(yaml.safe_load(fp)[15])
|
||||
trigger = list(map(dict, disk_data.pop("trigger")))
|
||||
condition = disk_data.pop("condition")
|
||||
action = list(map(dict, disk_data.pop("action")))
|
||||
@@ -202,7 +201,7 @@ class automation_update_tests(BaseTestCase):
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
with (self.config_folder / "automations.yaml").open("r") as fp:
|
||||
disk_data = dict(YAML().load(fp)[27])
|
||||
disk_data = dict(yaml.safe_load(fp)[27])
|
||||
trigger = list(map(dict, disk_data.pop("trigger")))
|
||||
condition = disk_data.pop("condition")
|
||||
action = list(map(dict, disk_data.pop("action")))
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import json
|
||||
from unittest import TestCase
|
||||
|
||||
from ruamel.yaml.scalarbool import ScalarBoolean
|
||||
from ruamel.yaml.scalarfloat import ScalarFloat
|
||||
from ruamel.yaml.scalarint import ScalarInt
|
||||
from ruamel.yaml.scalarstring import ScalarString
|
||||
|
||||
from src.json_serializer import json_dumps
|
||||
from src.yaml_serializer.types import NOT_IMPLEMENTED_SV_MSG, SecretValue
|
||||
@@ -34,25 +30,3 @@ class json_serializer_tests(TestCase):
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
def test_convert_ruamel_types(self):
|
||||
self.assertEqual(
|
||||
json_dumps(
|
||||
{
|
||||
"int": ScalarInt(1),
|
||||
"float": ScalarFloat(1.3),
|
||||
"bool": ScalarBoolean(False),
|
||||
"list": [1, ScalarString("w")],
|
||||
"tup": (1, ScalarString("w")),
|
||||
}
|
||||
),
|
||||
json.dumps(
|
||||
{
|
||||
"int": 1,
|
||||
"float": 1.3,
|
||||
"bool": 0,
|
||||
"list": [1, "w"],
|
||||
"tup": (1, "w"),
|
||||
},
|
||||
),
|
||||
)
|
||||
Reference in new issue
Block a user