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(