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

Incorrect used DB #317

Merged
merged 6 commits into from
Jan 11, 2021
Merged
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 HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ History
-------------------

* Provide CVSS scores on full report, when available
* Fixed used DB wrong info

1.10.1 (2021-01-03)
-------------------
Expand Down
6 changes: 3 additions & 3 deletions safety/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ def render_licenses(packages_licenses):

def get_used_db(key, db):
key = key if key else os.environ.get("SAFETY_API_KEY", False)
if db:
return "local DB"
if key:
return "pyup.io's DB"
if db == '':
return 'default DB'
return "local DB"
return "free DB (updated once a month)"


def report(vulns, full=False, json_report=False, bare_report=False, checked_packages=0, db=None, key=None):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_report_json(self):
assert json.loads(json_report) == test_arr

def test_get_used_db(self):
assert 'default DB' == formatter.get_used_db(key=None, db='')
assert 'free DB (updated once a month)' == formatter.get_used_db(key=None, db='')
assert 'pyup.io\'s DB' == formatter.get_used_db(key='foo', db='')
assert 'local DB' == formatter.get_used_db(key=None, db='/usr/local/some-db')

Expand Down