From 27ab49c36dc5e44854a00508aa09212e13c5178f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mind=C3=AAllo=20de=20Andrade?= Date: Wed, 20 Dec 2023 17:55:47 -0300 Subject: [PATCH] test: convert situation test --- tests/test_api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index 13535ed..719cc96 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -8,7 +8,7 @@ from requests import Response -from sunweg.api import APIHelper, SunWegApiError +from sunweg.api import APIHelper, convert_situation_status, SunWegApiError from sunweg.device import Inverter, String from sunweg.util import Status @@ -34,6 +34,16 @@ def setUp(self) -> None: response._content = "".join(f.readlines()).encode() self.responses[filename] = response + def test_convert_situation_status(self) -> None: + """Test the conversion from situation to status.""" + status_ok: Status = convert_situation_status(1) + status_err: Status = convert_situation_status(0) + status_wrn: Status = convert_situation_status(2) + + assert status_ok == Status.OK + assert status_err == Status.ERROR + assert status_wrn == Status.WARN + def test_error500(self) -> None: """Test error 500.""" with patch(