Skip to content

Commit

Permalink
Test coverage of the Air Purifier improved
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Mar 16, 2018
1 parent 17e8e69 commit 11d291a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions miio/tests/test_airpurifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ def extra_features():
self.device.set_extra_features(2)
assert extra_features() == 2

with pytest.raises(AirPurifierException):
self.device.set_extra_features(-1)

def test_reset_filter(self):
def filter_hours_used():
return self.device.status().filter_hours_used
Expand Down Expand Up @@ -328,3 +331,19 @@ def test_status_filter_rfid_product_ids(self):
assert self.state().filter_type is FilterType.Regular
self.device.state["rfid_product_id"] = '0:0:41:30'
assert self.state().filter_type is FilterType.AntiBacterial

def test_status_without_sleep_mode(self):
self.device._reset_state()
self.device.state["sleep_mode"] = None
assert self.state().sleep_mode is None

def test_status_without_app_extra(self):
self.device._reset_state()
self.device.state["app_extra"] = None
assert self.state().extra_features is None
assert self.state().turbo_mode_supported is None

def test_status_without_auto_detect(self):
self.device._reset_state()
self.device.state["act_det"] = None
assert self.state().auto_detect is None

0 comments on commit 11d291a

Please sign in to comment.