Skip to content

Commit

Permalink
PySafetyBear: Remove use of generic no cover
Browse files Browse the repository at this point in the history
Add `test_cve_key_checker`

Closes coala#2773
  • Loading branch information
seeeturtle authored and gitmate-bot committed Dec 1, 2018
1 parent cacfe6f commit 0f1cd3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bears/python/requirements/PySafetyBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


# It was for old versions of safety and those versions will be allow in future.
def cve_key_checker(vulnerability): # pragma: no cover
def cve_key_checker(vulnerability):
if 'cve' in vulnerability.data:
if vulnerability.data['cve'] is None:
return None
Expand Down
6 changes: 6 additions & 0 deletions tests/python/requirements/PySafetyBearTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class PySafetyBearTest(LocalBearTestHelper):
def setUp(self):
self.uut = PySafetyBear(Section('name'), Queue())

def test_cve_key_checker(self):
# avoid pragma: no cover
assert cve_key_checker(mock.Mock(data={'cve': None})) is None
assert cve_key_checker(mock.Mock(data={'cve': True}))
assert cve_key_checker(mock.Mock(data={})) is None

def test_without_vulnerability(self):
with mock.patch(
'bears.python.requirements.PySafetyBear.safety.check',
Expand Down

0 comments on commit 0f1cd3b

Please sign in to comment.