diff --git a/HISTORY.rst b/HISTORY.rst index 68fa5c93..0f7a1c93 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,7 @@ History ------------------- * Provide CVSS scores on full report, when available +* Fixed used DB wrong info * Support line breaks on advisories 1.10.1 (2021-01-03) diff --git a/safety/formatter.py b/safety/formatter.py index 079f8c09..a8ff3241 100644 --- a/safety/formatter.py +++ b/safety/formatter.py @@ -311,11 +311,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): diff --git a/tests/test_safety.py b/tests/test_safety.py index a810beb9..b0f5da27 100644 --- a/tests/test_safety.py +++ b/tests/test_safety.py @@ -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')