Skip to content

Commit 374de5e

Browse files
committed
Improve the pipeline structure and reduce the number of database queries
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent ca2fc64 commit 374de5e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

vulnerabilities/pipelines/v2_improvers/reference_collect_commits.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from vulnerabilities.models import PackageCommitPatch
1717
from vulnerabilities.pipelines import VulnerableCodeBaseImporterPipelineV2
1818
from vulnerabilities.pipes.advisory import VCS_URLS_SUPPORTED_TYPES
19-
from vulnerabilities.tests.test_export import package
2019
from vulnerabilities.utils import is_commit
2120

2221

@@ -73,4 +72,4 @@ def collect_and_store_fix_commits(self):
7372
package_commit_obj, _ = PackageCommitPatch.objects.get_or_create(
7473
vcs_url=vcs_url, commit_hash=commit_hash
7574
)
76-
package_commit_obj.fixed_impacted_packages.add(*impacted_packages)
75+
package_commit_obj.fixed_in_impacts.add(*impacted_packages)

vulnerabilities/tests/pipelines/v2_improvers/test_ref_collect_commits_v2.py renamed to vulnerabilities/tests/pipelines/v2_improvers/test_reference_collect_commits_v2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def test_collect_fix_commits_pipeline_creates_entry():
7575
fix = package_commit_patch.first()
7676
assert fix.commit_hash == "6bd301819f8f69331a55ae2336c8b111fc933f3d"
7777
assert fix.vcs_url == "https://github.com/test/testpkg"
78+
assert impact.fixed_by_package_commit_patches.count() == 1
7879

7980

8081
@pytest.mark.django_db

0 commit comments

Comments
 (0)