Skip to content

Commit 9b8cd07

Browse files
committed
Add a test for intorduced/fixed PackageCommitPatch
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 0084233 commit 9b8cd07

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

vulnerabilities/tests/pipes/test_vulnerablecode_importer_pipeline_v2.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def test_patch_advisory(dumpy_patch_advisory):
269269
adv = AdvisoryV2.objects.get(advisory_id="ADV-1234")
270270

271271
assert ImpactedPackage.objects.count() == 6
272+
272273
assert [
273274
(
274275
package_commit_patch.commit_hash,
@@ -291,6 +292,17 @@ def test_patch_advisory(dumpy_patch_advisory):
291292
"a5d6b89c35224d4ed69910a18fb544ca3fb26f62db53bc2769ce8a8d5cf8874c191186d170cb6e8896b0aaa8eaed891e7e819c4c0c7af499397c84761d6fb22d",
292293
),
293294
]
295+
296+
pkg_patches_that_fix = (
297+
PackageCommitPatch.objects.filter(fixed_in_impacts__isnull=False).distinct().count()
298+
)
299+
assert pkg_patches_that_fix == 1
300+
301+
pkg_patches_that_introduce = (
302+
PackageCommitPatch.objects.filter(introduced_in_impacts__isnull=False).distinct().count()
303+
)
304+
assert pkg_patches_that_introduce == 1
305+
294306
assert (
295307
PackageCommitPatch.objects.count() == 2
296308
) # Only 2 are created because the 6 inputs include duplicates with the VCS URL and commit_hash

0 commit comments

Comments
 (0)