Skip to content
Open
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
1 change: 1 addition & 0 deletions bodhi-client/bodhi/client/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ def query(self, **kwargs) -> 'munch.Munch':
gating (str): filter by TestGatingStatus description.
from_side_tag (bool): A boolean to filter updates created from side tag or from
normal workflow.
from_side_tag_name (str): Query for updates created from a certain side tag.
user (str): Query for updates submitted by a specific user.
rows_per_page (int): Limit the results to a certain number of rows per page
(min:1 max: 100 default: 20).
Expand Down
6 changes: 6 additions & 0 deletions bodhi-server/bodhi/server/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@ class ListUpdateSchema(PaginatedSchema, SearchableSchema, Cosmetics):
missing=None,
)

from_side_tag_name = colander.SchemaNode(
colander.String(),
location="querystring",
missing=None,
)

locked = colander.SchemaNode(
colander.Boolean(true_choices=('true', '1')),
location="querystring",
Expand Down
4 changes: 4 additions & 0 deletions bodhi-server/bodhi/server/services/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ def query_updates(request):
else:
query = query.filter(Update.from_tag.is_(None))

from_side_tag_name = data.get('from_side_tag_name')
if from_side_tag_name is not None:
query = query.filter(Update.from_tag == from_side_tag_name)

query = query.order_by(Update.date_submitted.desc())

# We can't use ``query.count()`` here because it is naive with respect to
Expand Down
27 changes: 27 additions & 0 deletions bodhi-server/tests/services/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3081,6 +3081,33 @@ def test_list_updates_by_not_from_side_tag(self):
assert up['alias'] == f'FEDORA-{YEAR}-a3bbe1a8f2'
assert up['karma'] == 1

def test_list_updates_by_from_side_tag_name(self):
up = self.db.query(Build).filter_by(nvr='bodhi-2.0-1.fc17').one().update
up.from_tag = 'f33-side-tag'
self.db.commit()
res = self.app.get('/updates/', {"from_side_tag_name": "f33-side-tag"})
body = res.json_body
assert len(body['updates']) == 1

up = body['updates'][0]
assert up['title'] == 'bodhi-2.0-1.fc17'
assert up['status'] == 'pending'
assert up['request'] == 'testing'
assert up['user']['name'] == 'guest'
assert up['release']['name'] == 'F17'
assert up['type'] == 'bugfix'
assert up['severity'] == 'medium'
assert up['suggest'] == 'unspecified'
assert up['close_bugs'] is True
assert up['notes'] == 'Useful details!'
assert up['date_submitted'] == '1984-11-02 00:00:00'
assert up['date_modified'] is None
assert up['date_approved'] is None
assert up['date_pushed'] is None
assert up['locked'] is False
assert up['alias'] == f'FEDORA-{YEAR}-a3bbe1a8f2'
assert up['karma'] == 1

def test_list_updates_by_multiple_usernames(self):
another_user = User(name='aUser')
self.db.add(another_user)
Expand Down
Loading