From f62f139f55d4a360ee10cfd8c1b22052e360ad6e Mon Sep 17 00:00:00 2001 From: Ari Date: Fri, 20 May 2022 12:32:36 -0400 Subject: [PATCH] fixed up tests --- api/pyproject.toml | 4 ---- api/tests/unittests/api/test_automations.py | 7 +++--- api/tests/unittests/test_json_serializer.py | 26 --------------------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/api/pyproject.toml b/api/pyproject.toml index 5101582..67816f8 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -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 \ No newline at end of file diff --git a/api/tests/unittests/api/test_automations.py b/api/tests/unittests/api/test_automations.py index c8c3cc3..317e09e 100644 --- a/api/tests/unittests/api/test_automations.py +++ b/api/tests/unittests/api/test_automations.py @@ -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"))) diff --git a/api/tests/unittests/test_json_serializer.py b/api/tests/unittests/test_json_serializer.py index 1e122b7..95c548d 100644 --- a/api/tests/unittests/test_json_serializer.py +++ b/api/tests/unittests/test_json_serializer.py @@ -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"), - }, - ), - )