Пример #1
0
 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())
Пример #2
0
 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())
Пример #3
0
 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())
Пример #4
0
 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())
Пример #5
0
 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())
Пример #6
0
 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())
Пример #7
0
 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())
Пример #8
0
 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())
Пример #9
0
 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())
Пример #10
0
 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)
Пример #11
0
 def test_tilt_calculation_initial(self):
     mock = DeviceMock('👨‍🏫')
     blind = Blind('👨‍🎓', 10, 20, mock, [], [])
     blind.override_tilt_duration(
         90)  # Makes calculation for checks much more easy =)
     # starting from 90
     blind.tilt(0)
     self.assertEqual(90, mock.time)
     self.assertEqual('open', mock.direction)
def blind(events: []) -> Blind:
    return Blind('test', 10, 20, DeviceMock('YOLO'), [], events)
def get_blind(name: str = 'Test') -> Blind:
    return Blind(name, 10, 20, DeviceMock(name), [], [])
Пример #14
0
 def test_done_tilt_moved_state(self):
     device = DeviceMock('TestDevice')
     blind = Blind('Test', 0, 0, device, [], [])
     device.move(50)
     tilt = Tilt(blind)
     self.assertFalse(tilt.done())
Пример #15
0
 def test_done_close_moved_state(self):
     device = DeviceMock('TestDevice')
     blind = Blind('Test', 0, 0, device, [], [])
     device.move(50)
     close = Close(blind)
     self.assertFalse(close.done())
Пример #16
0
 def test_done_pretilt_moved_state(self):
     device = DeviceMock('TestDevice')
     blind = Blind('Test', 0, 0, device, [], [])
     device.move(50)
     prepare = PreTilt(blind)
     self.assertFalse(prepare.done())
Пример #17
0
 def test_done_open_moved_state(self):
     device = DeviceMock('TestDevice')
     blind = Blind('Test', 0, 0, device, [], [])
     device.move(50)
     task = Open(blind)
     self.assertFalse(task.done())