File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 99
1010import json
1111import shutil
12+ from datetime import timezone
1213from pathlib import Path
1314
1415import dateparser
15- from django .core .exceptions import ValidationError
1616from fetchcode .vcs import fetch_via_vcs
1717
1818from vulnerabilities .importer import AdvisoryData
@@ -69,6 +69,8 @@ def collect_advisories(self):
6969 summary = vulnerability_data .get ("vulnerabilityType" )
7070 date_reported = vulnerability_data .get ("dateReported" )
7171 date_published = dateparser .parse (date_reported ) if date_reported else None
72+ if date_published and not date_published .tzinfo :
73+ date_published = date_published .replace (tzinfo = timezone .utc )
7274
7375 severities = []
7476 severity_value = vulnerability_data .get ("severity" )
Original file line number Diff line number Diff line change 2020
2121
2222@pytest .mark .django_db
23- def test_aosp_advisories1 ():
23+ def test_aosp_advisories ():
2424 expected_file = os .path .join (TEST_DATA , "aosp_advisoryv2-expected.json" )
2525 pipeline = AospImporterPipeline ()
2626 pipeline .vcs_response = Mock (dest_dir = TEST_DATA )
Original file line number Diff line number Diff line change 4141 "scoring_elements" : " "
4242 }
4343 ],
44- "date_published" : " 2018-04-04T00:00:00" ,
44+ "date_published" : " 2018-04-04T00:00:00+00:00 " ,
4545 "weaknesses" : [],
4646 "url" : " https://raw.githubusercontent.com/quarkslab/aosp_dataset/refs/heads/master/cves/CVE-aosp_test2.json"
4747 }
You can’t perform that action at this time.
0 commit comments