Skip to content

Commit f237cd9

Browse files
committed
Update test for the new dedupe pipeline
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent f9b4999 commit f237cd9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

vulnerabilities/tests/pipelines/test_remove_duplicate_advisories.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ def setUp(self):
2828
affected_packages=[
2929
AffectedPackage(
3030
package=PackageURL(type="npm", name="package1"),
31-
affected_version_range=">=1.0.0|<2.0.0",
31+
affected_version_range="vers:npm/>=1.0.0|<2.0.0",
3232
)
3333
],
3434
references=[Reference(url="https://example.com/vuln1")],
3535
)
3636

37-
def test_remove_duplicates_keeps_latest(self):
37+
def test_remove_duplicates_keeps_oldest(self):
3838
"""
3939
Test that when multiple advisories have the same content,
40-
only the latest one is kept.
40+
only the oldest one is kept.
4141
"""
4242
# Create three advisories with same content but different dates
4343
dates = [
@@ -56,11 +56,11 @@ def test_remove_duplicates_keeps_latest(self):
5656
date_collected=date,
5757
)
5858
advisories.append(advisory)
59+
print(advisory.id)
5960

6061
# Run the pipeline
6162
pipeline = RemoveDuplicateAdvisoriesPipeline()
62-
pipeline.recompute_content_ids()
63-
pipeline.remove_duplicates()
63+
pipeline.execute()
6464

6565
# Check that only the first advisory remains
6666
remaining = Advisory.objects.all()
@@ -90,7 +90,7 @@ def test_different_content_preserved(self):
9090

9191
# Run the pipeline
9292
pipeline = RemoveDuplicateAdvisoriesPipeline()
93-
pipeline.remove_duplicates()
93+
pipeline.execute()
9494

9595
# Check that both advisories remain
9696
self.assertEqual(Advisory.objects.count(), 2)
@@ -110,7 +110,7 @@ def test_recompute_content_ids(self):
110110

111111
# Run the pipeline
112112
pipeline = RemoveDuplicateAdvisoriesPipeline()
113-
pipeline.recompute_content_ids()
113+
pipeline.execute()
114114

115115
# Check that content ID was updated
116116
advisory.refresh_from_db()

0 commit comments

Comments
 (0)