def tests_timeline_registration(self):
"""Tests that timeline events register correctly."""
# Get the event controller
events = self.abode.events
self.assertIsNotNone(events)
# Create mock callback
callback = Mock()
# Test that a valid timeline event registers
self.assertTrue(
events.add_timeline_callback(
TIMELINE.CAPTURE_IMAGE, callback))
# Test that no timeline event returns false
self.assertFalse(events.add_timeline_callback(None, callback))
# Test that an invalid timeline event string throws exception
with self.assertRaises(abodepy.AbodeException):
events.add_timeline_callback("lol", callback)
# Test that an invalid timeline event dict throws exception
with self.assertRaises(abodepy.AbodeException):
events.add_timeline_callback({"lol": "lol"}, callback)
评论列表
文章目录