예제 #1
0
def query_plugins():
    """Query plugins."""
    train_id = get_train_id(request)

    manual_update = request.args.get('manual_update', default='false')
    manual_update = str_to_bool(manual_update, "manual_update")

    processor = TrainTaskManager(DATA_MANAGER)
    plugins = processor.get_plugins(train_id, manual_update)
    return jsonify(plugins)
    def test_get_plugins_with_train_id(self):
        """Test getting plugins with train id."""
        train_task_manager = TrainTaskManager(self._mock_data_manager)

        for train_id in self._train_id_list:
            result = train_task_manager.get_plugins(train_id)
            plugins = result.get('plugins')
            for plugin_name in plugins:
                if plugins.get(plugin_name):
                    assert train_id in self._plugins_id_map.get(plugin_name)
                else:
                    assert train_id not in self._plugins_id_map.get(plugin_name)