def provisioner_engine_list(): engine_cls = [] module_path = 'kqueen.engines' for engine in Provisioner.list_engines(): try: module = import_module(module_path) _class = getattr(module, engine) parameters = _class.get_parameter_schema() name = '.'.join([module_path, engine]) engine_cls.append({ 'name': name, 'verbose_name': getattr(_class, 'verbose_name', name), 'parameters': parameters }) except NotImplementedError: engine_cls.append({ 'name': engine, 'verbose_name': engine, 'parameters': { 'provisioner': {}, 'cluster': {} } }) except Exception: logger.error('Unable to read parameters for engine {}'.format(engine)) return jsonify(engine_cls)
def test_list_engines(self): engines = Provisioner.list_engines() assert engines == all_engines