Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split monolithic "vulnerabilities" Django app #132

Closed
wants to merge 6 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ before_script:
- ./manage.py migrate

script:
- python3.6 -m pytest -v vulnerabilities/tests/test_scrapers.py vulnerabilities/tests/test_api_data.py
- ./manage.py test vulnerabilities/tests
- python3.6 -m pytest -v importers/tests/test_scrapers.py api/tests/test_cve_search.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are changing this, what about running pytest -vvs only and adding a proper entry in setup.cfg to guide the discovery?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about changing this since I don't like passing files as arguments here either. But I don't know how to do this without reading some docs and I figured it will be changed as part of #127 anyway.

- ./manage.py test

notifications:
email: false
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ the code Django includes for this purpose: `SECRET_KEY=$(python -c "from django.

```
pycodestyle --exclude=migrations,settings.py,venv --max-line-length=100 .
python -m pytest -v vulnerabilities/tests/test_scrapers.py vulnerabilities/tests/test_api_data.py
python -m pytest -v importers/tests/test_scrapers.py api/tests/test_cve_search.py
```

For Django based tests
```
DJANGO_DEV=1 python manage.py test vulnerabilities.tests
DJANGO_DEV=1 python manage.py test
```

## Data import
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions api/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ApiConfig(AppConfig):
name = 'api'
File renamed without changes.
129 changes: 129 additions & 0 deletions api/fixtures/debian.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
[
{
"model": "core.vulnerability",
"pk": 1,
"fields": {
"cve_id": "CVE-2014-8242",
"summary": "",
"cvss": null
}
},
{
"model": "core.vulnerability",
"pk": 2,
"fields": {
"cve_id": "CVE-2009-1382",
"summary": "",
"cvss": null
}
},
{
"model": "core.vulnerability",
"pk": 3,
"fields": {
"cve_id": "CVE-2009-2459",
"summary": "",
"cvss": null
}
},
{
"model": "core.package",
"pk": 1,
"fields": {
"type": "deb",
"namespace": "debian",
"name": "librsync",
"version": "0.9.7-10",
"qualifiers": "distro=jessie",
"subpath": null
}
},
{
"model": "core.package",
"pk": 2,
"fields": {
"type": "deb",
"namespace": "debian",
"name": "mimetex",
"version": "1.74-1",
"qualifiers": "distro=jessie",
"subpath": null
}
},
{
"model": "core.package",
"pk": 3,
"fields": {
"type": "deb",
"namespace": "debian",
"name": "mimetex",
"version": "1.50-1.1",
"qualifiers": "distro=jessie",
"subpath": null
}
},
{
"model": "core.package",
"pk": 4,
"fields": {
"type": "deb",
"namespace": "debian",
"name": "mimetex",
"version": "1.74-1",
"qualifiers": "distro=jessie",
"subpath": null
}
},
{
"model": "core.package",
"pk": 5,
"fields": {
"type": "deb",
"namespace": "debian",
"name": "mimetex",
"version": "1.50-1.1",
"qualifiers": "distro=jessie",
"subpath": null
}
},
{
"model": "core.impactedpackage",
"pk": 1,
"fields": {
"vulnerability": 1,
"package": 1
}
},
{
"model": "core.resolvedpackage",
"pk": 1,
"fields": {
"vulnerability": 2,
"package": 2
}
},
{
"model": "core.resolvedpackage",
"pk": 2,
"fields": {
"vulnerability": 2,
"package": 3
}
},
{
"model": "core.resolvedpackage",
"pk": 3,
"fields": {
"vulnerability": 3,
"package": 4
}
},
{
"model": "core.resolvedpackage",
"pk": 4,
"fields": {
"vulnerability": 3,
"package": 5
}
}
]
Loading