-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new file for tests related to packages and test the package json feed in it's basic form.
- Loading branch information
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from flask import url_for | ||
from werkzeug.exceptions import NotFound | ||
|
||
from tracker.model.cve import issue_types | ||
from tracker.model.enum import Publication | ||
|
||
from .conftest import DEFAULT_ADVISORY_ID | ||
from .conftest import DEFAULT_GROUP_ID | ||
from .conftest import create_advisory | ||
from .conftest import create_group | ||
from .conftest import create_package | ||
|
||
|
||
@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], reference='https://security.archlinux.org', publication=Publication.published) | ||
def test_show_package_json(db, client): | ||
resp = client.get(url_for('tracker.show_package_json', pkgname='foo', suffix='/json'), follow_redirects=True) | ||
assert 200 == resp.status_code | ||
data = resp.get_json() | ||
assert len(data['groups']) == 1 | ||
assert len(data['versions']) == 1 | ||
assert len(data['advisories']) == 1 | ||
assert len(data['issues']) == 1 | ||
assert data['name'] == 'foo' | ||
|
||
|
||
def test_show_package_json_not_found(db, client): | ||
resp = client.get(url_for('tracker.show_package_json', pkgname='foo', suffix='/json'), follow_redirects=True) | ||
assert NotFound.code == resp.status_code |