Skip to content
This repository was archived by the owner on May 28, 2022. It is now read-only.

Commit a6ff176

Browse files
Implements list plugins in category.
1 parent c13ff72 commit a6ff176

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/freeseer/frontend/controller/configuration.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from freeseer import settings, logging
2828
from freeseer.framework.config.exceptions import InvalidOptionValueError
2929
from freeseer.framework.config.profile import ProfileDoesNotExist, ProfileAlreadyExists
30+
from freeseer.framework.plugin import PluginManager
3031
from freeseer.frontend.controller.server import http_response, HTTPError
3132

3233
log = logging.getLogger(__name__)
@@ -236,11 +237,13 @@ def modify_recording_configuration(profile):
236237
def list_plugin_category(profile, category):
237238
"""
238239
List the available plugins for the given :profile and plugin :category.
239-
240-
TODO: Needs two things: ChoiceOptions to return selection and list of options,
241-
and plugin categories to use ChoiceOptions.
242240
"""
243-
raise HTTPError('Unimplemented', 501)
241+
profile = load_configuration(profile)
242+
plugin_manager = PluginManager(profile)
243+
plugin_infos = plugin_manager.get_plugins_of_category(plugins_map[category])
244+
return {
245+
'plugins': [plugin.name for plugin in plugin_infos]
246+
}
244247

245248

246249
#

src/freeseer/tests/frontend/controller/test_configuration.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ def test_view_recording_configuration(self, test_client, configuration):
173173

174174
def test_list_plugin_category(self, test_client, configuration):
175175
response = test_client.get('/profiles/testing/recording/audioinput')
176-
assert response.status_code == 501
176+
plugin_infos = configuration.plugin_manager.get_plugins_of_category('AudioInput')
177+
expected = {'plugins': [plugin.name for plugin in plugin_infos]}
178+
data = json.loads(response.data)
179+
assert data == expected
180+
assert response.status_code == 200
177181

178182
def test_list_plugin_instances(self, test_client, configuration):
179183
response = test_client.get('/profiles/testing/recording/audioinput/jackaudiosrc')

0 commit comments

Comments
 (0)