Skip to content

Commit

Permalink
Add help message for 'active' filter.
Browse files Browse the repository at this point in the history
JIRA: PDC-1219
  • Loading branch information
xychu committed Dec 8, 2015
1 parent f097133 commit 1ba73e8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pdc_client/plugins/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ def register(self):

list_parser = self.add_action('list', help='list all release components')
self.add_include_inactive_release_argument(list_parser)
filters = ('active brew_package bugzilla_component global_component name release srpm_name '
list_parser.add_argument('--active', dest='filter_active', choices=['True', 'False',
'true', 'false',
't', 'f', '1', '0'],
help='show active(True) or inactive(False) release component(s).')
filters = ('brew_package bugzilla_component global_component name release srpm_name '
'type'.split())
for arg in filters:
list_parser.add_argument('--' + arg.replace('_', '-'), dest='filter_' + arg)
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions tests/component/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@ def test_list_multi_page(self, api):
[('GET', {'page': 1, 'release': 'Test Release'}),
('GET', {'page': 2, 'release': 'Test Release'})])

def test_list_active(self, api):
api.add_endpoint('release-components', 'GET', [])
with self.expect_output('release_component/empty.txt'):
self.runner.run(['release-component', 'list', '--active', 'True'])
self.assertEqual(api.calls['release-components'],
[('GET', {'page': 1, 'active': 'True'})])

def test_list_inactive(self, api):
api.add_endpoint('release-components', 'GET', [])
with self.expect_output('release_component/empty.txt'):
self.runner.run(['release-component', 'list', '--active', 'False'])
self.assertEqual(api.calls['release-components'],
[('GET', {'page': 1, 'active': 'False'})])

def test_detail(self, api):
api.add_endpoint('release-components', 'GET', [self.detail])
api.add_endpoint('release-component-contacts',
Expand Down

0 comments on commit 1ba73e8

Please sign in to comment.