def test_init_scene_configs_and_yaml(self): launcher = Launcher( mock.Mock(), get_reachable_lights([1, 2]), [self._sc_breath, self._sc_rainbow], scene_configs_file=self.yaml_file, ) self.assertEqual(len(launcher.scenes), 4)
def test_method_init(self): launcher = Launcher(mock.Mock(), get_reachable_lights([1, 2]), [self._sc_rainbow, self._sc_breath]) self.assertEqual(launcher.scenes[0].title, 'Rainbow') self.assertEqual(launcher.scenes[0].description, 'Cycle between three colors.') self.assertEqual(launcher.scenes[0].duration, 1) self.assertEqual(launcher.scenes[1].title, 'Breath') self.assertEqual(launcher.scenes[1].description, 'Breathing colors.') self.assertEqual(launcher.scenes[1].duration, 2)
def test_method_launch_scene(self): launcher = Launcher(mock.Mock(), get_reachable_lights([1, 2])) launcher.launch_scene(self._sc_rainbow)
def test_method_init_invalid(self): with self.assertRaises(ValueError): Launcher(mock.Mock(), get_reachable_lights([1, 2]), [self._sc_invalid_breath, self._sc_rainbow])
def test_method_get_scene_class_exception(self): with self.assertRaises(AttributeError): Launcher._get_scene_class('xxx')
def test_method_read_yaml(self): yaml_file = os.path.join(os.path.dirname(__file__), 'scenes.yml') scene_configs = Launcher._read_yaml(yaml_file) self.assertEqual(scene_configs[0]['title'], 'Rainbow')
def test_method_get_scene_class(self): scene = Launcher._get_scene_class('pendulum') self.assertEqual(scene.__name__, 'ScenePendulum')