Skip to content

Commit

Permalink
test: convert situation test
Browse files Browse the repository at this point in the history
  • Loading branch information
rokam committed Dec 20, 2023
1 parent ddabe05 commit 27ab49c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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(
Expand Down

0 comments on commit 27ab49c

Please sign in to comment.