Skip to content

Commit

Permalink
✅ Fix tests and lint
Browse files Browse the repository at this point in the history
Follow up #5
  • Loading branch information
AndreMiras committed Jan 7, 2023
1 parent 3bb4fab commit e1a07e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions edilkamin/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ def set_chrono_mode(token: str, mac_address: str, chrono_mode: bool) -> str:
Set chrono mode.
Return response string e.g. "Command 0123456789abcdef executed successfully".
"""
return mqtt_command(token, mac_address, {"name": "chrono_mode", "value": chrono_mode})
return mqtt_command(
token, mac_address, {"name": "chrono_mode", "value": chrono_mode}
)


def device_info_get_easy_timer(info: typing.Dict) -> int:
Expand All @@ -353,7 +355,7 @@ def device_info_get_easy_timer(info: typing.Dict) -> int:
def get_easy_timer(token: str, mac_address: str) -> str:
"""Get easy timer value."""
info = device_info(token, mac_address)
easy_time_status=info["status"]["flags"]["is_easytimer_active"]
easy_time_status = info["status"]["flags"]["is_easytimer_active"]
if not easy_time_status:
return easy_time_status
return device_info_get_easy_timer(info)
Expand All @@ -364,4 +366,4 @@ def set_easy_timer(token: str, mac_address: str, easy_timer: int) -> str:
Set easy timer value.
Return response string e.g. "Command 0123456789abcdef executed successfully".
"""
return mqtt_command(token, mac_address, {"name": "easytimer", "value": easy_timer})
return mqtt_command(token, mac_address, {"name": "easytimer", "value": easy_timer})
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_set_fan_speed(fans_number, warning, expected_return):

def test_get_airkare():
airkare_function = False
json_response = {"status": {"commands": {"airkare_function": airkare_function}}}
json_response = {"status": {"flags": {"is_airkare_active": airkare_function}}}
with patch_requests_get(json_response) as m_get:
assert api.get_airkare(token, mac_address) == airkare_function
assert m_get.call_count == 1
Expand All @@ -365,7 +365,7 @@ def test_set_airkare():

def test_get_relax_mode():
relax_mode = False
json_response = {"nvm": {"user_parameters": {"is_relax_active": relax_mode}}}
json_response = {"status": {"flags": {"is_relax_active": relax_mode}}}
with patch_requests_get(json_response) as m_get:
assert api.get_relax_mode(token, mac_address) == relax_mode
assert m_get.call_count == 1
Expand Down

0 comments on commit e1a07e5

Please sign in to comment.