Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pwclient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def patch_list(
state,
archived,
msgid,
series,
name,
hash,
max_count=None,
Expand Down Expand Up @@ -248,6 +249,7 @@ def patch_list(
state,
archived,
msgid,
series,
name,
hash,
max_count=None,
Expand All @@ -263,6 +265,9 @@ def patch_list(
if msgid:
filters['msgid'] = msgid

if series:
filters['series'] = series

if name:
filters['name__icontains'] = name

Expand Down Expand Up @@ -772,6 +777,7 @@ def patch_list(
state,
archived,
msgid,
series,
name,
hash,
max_count=None,
Expand All @@ -797,6 +803,9 @@ def patch_list(
if msgid is not None:
filters['msgid'] = msgid

if series:
filters['series'] = series

if archived is not None:
filters['archived'] = archived

Expand Down
3 changes: 3 additions & 0 deletions pwclient/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def _get_filter_parser():
filter_parser.add_argument(
'-H', '--hash', metavar='HASH', help="filter by hash"
)
filter_parser.add_argument(
'-S', '--series', metavar='SERIES_ID', help="filter by series ID"
)
filter_parser.add_argument(
'-f',
'--format',
Expand Down
2 changes: 2 additions & 0 deletions pwclient/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def action_list(
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -77,6 +78,7 @@ def action_list(
'state': state,
'archived': archived,
'msgid': msgid,
'series': series,
'name': name,
'hash': hash,
'max_count': max_count,
Expand Down
1 change: 1 addition & 0 deletions pwclient/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def main(argv=sys.argv[1:]):
state=args.state,
archived=args.archived,
msgid=args.msgid,
series=args.series,
name=args.patch_name,
hash=args.hash,
max_count=args.max_count,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_action_list__no_submitter_no_delegate(mock_list_patches, capsys):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand Down Expand Up @@ -146,6 +147,7 @@ def test_action_list__submitter_filter(mock_list_patches, capsys):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand Down Expand Up @@ -174,6 +176,7 @@ def test_action_list__delegate_filter(mock_list_patches, capsys):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand Down
36 changes: 36 additions & 0 deletions tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ def test_list__no_options(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -644,6 +645,7 @@ def test_list__state_filter(mock_action, mock_api, mock_config):
state='Accepted',
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -668,6 +670,7 @@ def test_list__archived_filter(mock_action, mock_api, mock_config):
state=None,
archived=True,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand Down Expand Up @@ -698,6 +701,7 @@ def test_list__project_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -722,6 +726,7 @@ def test_list__submitter_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -746,6 +751,7 @@ def test_list__delegate_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -770,6 +776,7 @@ def test_list__msgid_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid='fakemsgid',
series=None,
name=None,
hash=None,
max_count=None,
Expand All @@ -794,6 +801,7 @@ def test_list__name_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name='fake patch name',
hash=None,
max_count=None,
Expand All @@ -818,6 +826,7 @@ def test_list__limit_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=5,
Expand All @@ -842,6 +851,7 @@ def test_list__limit_reverse_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash=None,
max_count=-5,
Expand All @@ -866,13 +876,39 @@ def test_list__hash_filter(mock_action, mock_api, mock_config):
state=None,
archived=None,
msgid=None,
series=None,
name=None,
hash='3143a71a9d33f4f12b4469818d205125cace6535',
max_count=None,
format_str=None,
)


@mock.patch.object(utils.configparser, 'ConfigParser')
@mock.patch.object(shell.os.path, 'exists', new=mock.Mock(return_value=True))
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__series_filter(mock_action, mock_api, mock_config):
mock_config.return_value = FakeConfig()

shell.main(['list', '-S', '499314'])

mock_action.assert_called_once_with(
mock_api.return_value,
project=DEFAULT_PROJECT,
submitter=None,
delegate=None,
state=None,
archived=None,
msgid=None,
series='499314',
name=None,
hash=None,
max_count=None,
format_str=None,
)


@mock.patch.object(utils.configparser, 'ConfigParser')
@mock.patch.object(shell.os.path, 'exists', new=mock.Mock(return_value=True))
@mock.patch.object(api, 'XMLRPC')
Expand Down
Loading