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
9 changes: 9 additions & 0 deletions test/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def test_show_group(db, client):
assert 'text/html; charset=utf-8' == resp.content_type
assert DEFAULT_GROUP_NAME in resp.data.decode()

@create_package(name='foo', version='1.2.3-4')
@create_group(id=DEFAULT_GROUP_ID, packages=['foo'], affected='1.2.3-3', fixed='1.2.3-4')
@create_advisory(id=DEFAULT_ADVISORY_ID, group_package_id=DEFAULT_GROUP_ID, advisory_type=issue_types[1])
def test_show_group_json(db, client):
Expand All @@ -348,6 +349,14 @@ def test_show_group_json(db, client):
assert data['name'] == DEFAULT_GROUP_NAME
assert data['issues'] == [DEFAULT_ISSUE_ID]
assert data['packages'] == ['foo']
assert data['versions'] == [
{
'name': 'foo',
'version': '1.2.3-4',
'arch': 'any',
'repository': 'core',
}
]
assert data['affected'] == '1.2.3-3'
assert data['fixed'] == '1.2.3-4'

Expand Down
9 changes: 9 additions & 0 deletions tracker/view/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@ def show_group_json(avg):
json_data = OrderedDict()
json_data['name'] = group.name
json_data['packages'] = [package.pkgname for package in packages]
json_data['versions'] = [
{
'name': package.name,
'version': package.version,
'arch': package.arch,
'repository': package.database,
}
for package in data['versions']
]
json_data['status'] = group.status.label
json_data['severity'] = group.severity.label
json_data['type'] = 'multiple issues' if len(issue_types) > 1 else issue_types[0]
Expand Down