File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
miio/integrations/roborock/vacuum/tests Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ from unittest .mock import MagicMock
2+
3+ from miio import DeviceException
4+
5+ from ..updatehelper import UpdateHelper
6+
7+
8+ def test_updatehelper ():
9+ """Test that update helper removes erroring methods from future updates."""
10+ main_status = MagicMock ()
11+ second_status = MagicMock ()
12+ unsupported = MagicMock (side_effect = DeviceException ("Broken" ))
13+ helper = UpdateHelper (main_status )
14+ helper .add_update_method ("working" , second_status )
15+ helper .add_update_method ("broken" , unsupported )
16+
17+ helper .status ()
18+
19+ main_status .assert_called_once ()
20+ second_status .assert_called_once ()
21+ unsupported .assert_called_once ()
22+
23+ # perform second update
24+ helper .status ()
25+
26+ assert main_status .call_count == 2
27+ assert second_status .call_count == 2
28+ assert unsupported .call_count == 1
You can’t perform that action at this time.
0 commit comments