def test_done_pretilt_open_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Open(blind).do() self.assertEqual(1, device.open_counter) self.assertEqual(State.OPEN, device.stats()) prepare = PreTilt(blind) self.assertFalse(prepare.done())
def test_done_close_close_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Close(blind).do() self.assertEqual(1, device.close_counter) self.assertEqual(State.CLOSED, device.stats()) close = Close(blind) self.assertTrue(close.done())
def test_done_tilt_different_tilt_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Tilt(blind, 45).do() self.assertEqual(1, device.tilt_counter) self.assertEqual(State.TILT, device.stats()) tilt = Tilt(blind) self.assertFalse(tilt.done())
def test_done_close_open_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Open(blind).do() self.assertEqual(1, device.open_counter) self.assertEqual(State.OPEN, device.stats()) close = Close(blind) self.assertFalse(close.done())
def test_done_tilt_close_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Close(blind).do() self.assertEqual(1, device.close_counter) self.assertEqual(State.CLOSED, device.stats()) tilt = Tilt(blind) self.assertFalse(tilt.done())
def test_done_pretilt_tilt_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Tilt(blind).do() self.assertEqual(1, device.tilt_counter) self.assertEqual(State.TILT, device.stats()) prepare = PreTilt(blind) self.assertTrue(prepare.done())
def test_done_open_tilt_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Tilt(blind).do() self.assertEqual(1, device.tilt_counter) self.assertEqual(State.TILT, device.stats()) task = Open(blind) self.assertFalse(task.done())
def test_done_open_open_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Open(blind).do() self.assertEqual(1, device.open_counter) self.assertEqual(State.OPEN, device.stats()) task = Open(blind) self.assertTrue(task.done())
def test_done_close_tilt_state(self): device = DeviceMock('TestDevice') blind = Blind('Test', 0, 0, device, [], []) Tilt(blind).do() self.assertEqual(1, device.tilt_counter) self.assertEqual(State.TILT, device.stats()) close = Close(blind) self.assertFalse(close.done())
def test_tilt_calculation_close(self): mock = DeviceMock('👨🏫') blind = Blind('👨🎓', 10, 20, mock, [], []) blind.override_tilt_duration( 90) # Makes calculation for checks much more easy =) blind.close() self.assertEqual(State.CLOSED, mock.stats()) blind.tilt(0) self.assertEqual(90, mock.time) self.assertEqual('open', mock.direction)