Repository: fedora-infra/bodhi

Issue:
document query(alias=) and query(updateid=)
The new fields were added in #164, but they do not show up in the docstring.

python-fedora-0.5.4-1.fc22.noarch



Discussion:
Btw, it would be great to also clear the confusion between `alias` and `updateid`. Because the web UI now mentions `Update ID`, the API returns `update['alias']` and `update['old_updateid']`. If `query()` is going to take `alias=` and `updateid=`, it's going to be somewhat confusing. "Alias" would be used in 2 out of 3 places, and "update id" would be used in (different) 2 out of 3 places.

I would like to make the changes.


Resolving patch:
diff --git a/bodhi/client/__init__.py b/bodhi/client/__init__.py
--- a/bodhi/client/__init__.py
+++ b/bodhi/client/__init__.py
@@ -459,8 +459,11 @@ def edit(user, password, url, debug, **kwargs):
 
 @updates.command()
 @click.option('--updateid', help='Query by update ID (eg: FEDORA-2015-0001)')
+@click.option('--alias', help='Query by alias')
 @click.option('--approved-since', help='Approved after a specific timestamp')
+@click.option('--approved-before', help='Approved before a specific timestamp')
 @click.option('--modified-since', help='Modified after a specific timestamp')
+@click.option('--modified-before', help='Modified before a specific timestamp')
 @click.option('--builds', help='Query updates based on builds')
 @click.option('--bugs', help='A list of bug numbers')
 @click.option('--critpath', is_flag=True, default=None,
@@ -473,12 +476,20 @@ def edit(user, password, url, debug, **kwargs):
               help='Filter by pushed updates')
 @click.option('--pushed-since',
               help='Updates that have been pushed after a certain time')
+@click.option('--pushed-before',
+              help='Updates that have been pushed before a certain time')
 @click.option('--releases', help='Updates for specific releases')
+@click.option('--active-releases', is_flag=True, default=None,
+              help='Updates for active releases')
 @click.option('--locked', help='Updates that are in a locked state')
 @click.option('--request', help='Updates with a specific request',
               type=click.Choice(['testing', 'stable', 'unpush', 'batched']))
+@click.option('--severity', help='Updates with a specific severity',
+              type=click.Choice(['unspecified', 'urgent', 'high', 'medium', 'low']))
 @click.option('--submitted-since',
               help='Updates that have been submitted since a certain time')
+@click.option('--submitted-before',
+              help='Updates that have been submitted before a certain time')
 @click.option('--status', help='Filter by update status',
               type=click.Choice(['pending', 'testing', 'stable', 'obsolete',
                                  'unpushed', 'processing']))
diff --git a/bodhi/client/bindings.py b/bodhi/client/bindings.py
--- a/bodhi/client/bindings.py
+++ b/bodhi/client/bindings.py
@@ -302,9 +302,12 @@ def query(self, **kwargs):
         Query bodhi for a list of updates.
 
         Args:
+            alias (basestring): The update alias.
+            updateid (basestring): The update ID (eg: FEDORA-2015-0001).
             content_type (basestring): A content type (rpm, module) to limit the query to.
             releases (basestring): A comma separated list of releases that you wish to query updates
                 for.
+            active_releases (bool): A boolean to filter only updates for active releases.
             status (basestring): The update status (``pending``, ``testing``, ``stable``,
                 ``obsolete``, ``unpushed``, ``processing``)
             type (basestring): The type of the update: ``security``, ``bugfix``,


Test patch:
diff --git a/bodhi/tests/client/test___init__.py b/bodhi/tests/client/test___init__.py
--- a/bodhi/tests/client/test___init__.py
+++ b/bodhi/tests/client/test___init__.py
@@ -656,14 +656,15 @@ def test_query_single_update(self, send_request):
             mock.call(
                 bindings_client, 'updates/', verb='GET',
                 params={
-                    'approved_since': None, 'status': None, 'locked': None,
+                    'updateid': None, 'alias': None, 'approved_since': None,
+                    'approved_before': None, 'status': None, 'locked': None,
                     'builds': u'nodejs-grunt-wrap-0.3.0-2.fc25', 'releases': None,
-                    'content_type': None,
-                    'submitted_since': None, 'suggest': None, 'request': None, 'bugs': None,
-                    'staging': False, 'modified_since': None, 'pushed': None,
-                    'pushed_since': None, 'user': None, 'critpath': None, 'updateid': None,
-                    'packages': None, 'type': None, 'cves': None, 'rows_per_page': None,
-                    'page': None
+                    'active_releases': None, 'content_type': None, 'severity': None,
+                    'submitted_since': None, 'submitted_before': None, 'suggest': None,
+                    'request': None, 'bugs': None, 'staging': False, 'modified_since': None,
+                    'modified_before': None, 'pushed': None, 'pushed_since': None,
+                    'pushed_before': None, 'user': None, 'critpath': None, 'packages': None,
+                    'type': None, 'cves': None, 'rows_per_page': None, 'page': None,
                 }
             ),
             mock.call(
@@ -696,13 +697,15 @@ def test_query_multiple_update(self, send_request):
         send_request.assert_called_once_with(
             bindings_client, 'updates/', verb='GET',
             params={
-                'approved_since': None, 'status': None, 'locked': None,
+                'updateid': None, 'alias': None, 'approved_since': None,
+                'approved_before': None, 'status': None, 'locked': None,
                 'builds': u'nodejs-grunt-wrap-0.3.0-2.fc25', 'releases': None,
-                'content_type': None,
-                'submitted_since': None, 'suggest': None, 'request': None, 'bugs': None,
-                'staging': False, 'modified_since': None, 'pushed': None, 'pushed_since': None,
-                'user': None, 'critpath': None, 'updateid': None, 'packages': None, 'type': None,
-                'cves': None, 'rows_per_page': None, 'page': None})
+                'active_releases': None, 'content_type': None, 'severity': None,
+                'submitted_since': None, 'submitted_before': None, 'suggest': None,
+                'request': None, 'bugs': None, 'staging': False, 'modified_since': None,
+                'modified_before': None, 'pushed': None, 'pushed_since': None,
+                'pushed_before': None, 'user': None, 'critpath': None, 'packages': None,
+                'type': None, 'cves': None, 'rows_per_page': None, 'page': None})
 
     @mock.patch('bodhi.client.bindings.BodhiClient.csrf',
                 mock.MagicMock(return_value='a_csrf_token'))
@@ -727,14 +730,15 @@ def test_url_flag(self, send_request):
             mock.call(
                 bindings_client, 'updates/', verb='GET',
                 params={
-                    'approved_since': None, 'status': None, 'locked': None,
+                    'updateid': None, 'alias': None, 'approved_since': None,
+                    'approved_before': None, 'status': None, 'locked': None,
                     'builds': u'nodejs-grunt-wrap-0.3.0-2.fc25', 'releases': None,
-                    'content_type': None,
-                    'submitted_since': None, 'suggest': None, 'request': None, 'bugs': None,
-                    'staging': False, 'modified_since': None, 'pushed': None,
-                    'pushed_since': None, 'user': None, 'critpath': None, 'updateid': None,
-                    'packages': None, 'type': None, 'cves': None, 'rows_per_page': None,
-                    'page': None
+                    'active_releases': None, 'content_type': None, 'severity': None,
+                    'submitted_since': None, 'submitted_before': None, 'suggest': None,
+                    'request': None, 'bugs': None, 'staging': False, 'modified_since': None,
+                    'modified_before': None, 'pushed': None, 'pushed_since': None,
+                    'pushed_before': None, 'user': None, 'critpath': None, 'packages': None,
+                    'type': None, 'cves': None, 'rows_per_page': None, 'page': None
                 }
             ),
             mock.call(
@@ -767,13 +771,15 @@ def test_query_mine_flag_username_unset(self, mock_input, send_request):
             mock.call(
                 bindings_client, 'updates/', verb='GET',
                 params={
-                    'approved_since': None, 'status': None, 'locked': None,
-                    'builds': None, 'releases': None,
-                    'content_type': None,
-                    'submitted_since': None, 'suggest': None, 'request': None, 'bugs': None,
-                    'staging': False, 'modified_since': None, 'pushed': None, 'pushed_since': None,
-                    'user': 'dudemcpants', 'critpath': None, 'updateid': None, 'packages': None,
-                    'type': None, 'cves': None, 'rows_per_page': None, 'page': None
+                    'updateid': None, 'alias': None, 'approved_since': None,
+                    'approved_before': None, 'status': None, 'locked': None,
+                    'builds': None, 'releases': None, 'active_releases': None,
+                    'content_type': None, 'severity': None, 'submitted_since': None,
+                    'submitted_before': None, 'suggest': None, 'request': None, 'bugs': None,
+                    'staging': False, 'modified_since': None, 'modified_before': None,
+                    'pushed': None, 'pushed_since': None, 'pushed_before': None,
+                    'user': 'dudemcpants', 'critpath': None, 'packages': None,
+                    'type': None, 'cves': None, 'rows_per_page': None, 'page': None,
                 }
             ),
             mock.call(
@@ -805,12 +811,14 @@ def test_rows_flag(self, send_request):
             mock.call(
                 bindings_client, 'updates/', verb='GET',
                 params={
-                    'approved_since': None, 'status': None, 'locked': None,
+                    'updateid': None, 'alias': None, 'approved_since': None,
+                    'approved_before': None, 'status': None, 'locked': None,
                     'builds': None, 'releases': None,
-                    'content_type': None,
-                    'submitted_since': None, 'suggest': None, 'request': None, 'bugs': None,
-                    'staging': False, 'modified_since': None, 'pushed': None, 'pushed_since': None,
-                    'user': None, 'critpath': None, 'updateid': None, 'packages': None,
+                    'active_releases': None, 'content_type': None, 'severity': None,
+                    'submitted_since': None, 'submitted_before': None, 'suggest': None,
+                    'request': None, 'bugs': None, 'staging': False, 'modified_since': None,
+                    'modified_before': None, 'pushed': None, 'pushed_since': None,
+                    'pushed_before': None, 'user': None, 'critpath': None, 'packages': None,
                     'type': None, 'cves': None, 'rows_per_page': 10, 'page': None
                 }
             ),
@@ -842,12 +850,15 @@ def test_page_flag(self, send_request):
             mock.call(
                 bindings_client, 'updates/', verb='GET',
                 params={
-                    'approved_since': None, 'pushed': None, 'pushed_since': None,
-                    'critpath': None, 'cves': None, 'rows_per_page': None, 'staging': False,
-                    'submitted_since': None, 'suggest': None, 'updateid': None,
-                    'type': None, 'status': None, 'releases': None, 'modified_since': None,
-                    'user': None, 'content_type': None, 'packages': None, 'locked': None,
-                    'builds': None, 'request': None, 'bugs': None, 'page': 5
+                    'updateid': None, 'alias': None, 'approved_since': None,
+                    'approved_before': None, 'status': None, 'locked': None,
+                    'builds': None, 'releases': None,
+                    'active_releases': None, 'content_type': None, 'severity': None,
+                    'submitted_since': None, 'submitted_before': None, 'suggest': None,
+                    'request': None, 'bugs': None, 'staging': False, 'modified_since': None,
+                    'modified_before': None, 'pushed': None, 'pushed_since': None,
+                    'pushed_before': None, 'user': None, 'critpath': None, 'packages': None,
+                    'type': None, 'cves': None, 'rows_per_page': None, 'page': 5
                 },
             ),
             mock.call(