-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Assume UTC when no offset it specified (#941)
* Change: Assume UTC when no offset it specified * Fix: Unit tests
- Loading branch information
Showing
8 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
# pylint: disable=line-too-long, arguments-differ, redefined-builtin | ||
|
||
from datetime import datetime | ||
from datetime import datetime, timezone | ||
from typing import Any, Dict, List, Optional | ||
from unittest.mock import MagicMock, patch | ||
|
||
|
@@ -111,10 +111,12 @@ async def test_cve(self): | |
self.assertEqual(cve.id, "CVE-2022-45536") | ||
self.assertEqual(cve.source_identifier, "[email protected]") | ||
self.assertEqual( | ||
cve.published, datetime(2022, 11, 22, 21, 15, 11, 103000) | ||
cve.published, | ||
datetime(2022, 11, 22, 21, 15, 11, 103000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual( | ||
cve.last_modified, datetime(2022, 11, 23, 16, 2, 7, 367000) | ||
cve.last_modified, | ||
datetime(2022, 11, 23, 16, 2, 7, 367000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual(len(cve.descriptions), 1) | ||
self.assertEqual(len(cve.references), 2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,8 @@ async def test_cve_changes(self): | |
) | ||
self.assertEqual(cve_change.source_identifier, "[email protected]") | ||
self.assertEqual( | ||
cve_change.created, datetime(2022, 3, 18, 20, 13, 8, 123000) | ||
cve_change.created, | ||
datetime(2022, 3, 18, 20, 13, 8, 123000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual( | ||
cve_change.details, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
# ruff: noqa: E501 | ||
|
||
import unittest | ||
from datetime import date, datetime | ||
from datetime import date, datetime, timezone | ||
|
||
from pontos.nvd.models import cvss_v2, cvss_v3 | ||
from pontos.nvd.models.cve import CVE, CVSSType, Operator | ||
|
@@ -33,10 +33,12 @@ def test_required_only(self): | |
self.assertEqual(cve.id, "CVE-2022-45536") | ||
self.assertEqual(cve.source_identifier, "[email protected]") | ||
self.assertEqual( | ||
cve.published, datetime(2022, 11, 22, 21, 15, 11, 103000) | ||
cve.published, | ||
datetime(2022, 11, 22, 21, 15, 11, 103000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual( | ||
cve.last_modified, datetime(2022, 11, 23, 16, 2, 7, 367000) | ||
cve.last_modified, | ||
datetime(2022, 11, 23, 16, 2, 7, 367000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual(len(cve.descriptions), 1) | ||
self.assertEqual(len(cve.references), 2) | ||
|
@@ -506,7 +508,9 @@ def test_vendor_comments(self): | |
comment.comment, | ||
"Fixed in Apache HTTP Server 1.3.12:\nhttp://httpd.apache.org/security/vulnerabilities_13.html", | ||
) | ||
self.assertEqual(comment.last_modified, datetime(2008, 7, 2)) | ||
self.assertEqual( | ||
comment.last_modified, datetime(2008, 7, 2, tzinfo=timezone.utc) | ||
) | ||
|
||
def test_evaluator_comment(self): | ||
cve = CVE.from_dict( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# ruff: noqa: E501 | ||
|
||
import unittest | ||
from datetime import datetime | ||
from datetime import datetime, timezone | ||
from uuid import UUID | ||
|
||
from pontos.nvd.models.cve_change import CVEChange, Detail, EventName | ||
|
@@ -25,7 +25,8 @@ def test_required_only(self): | |
) | ||
self.assertEqual(cve_change.source_identifier, "[email protected]") | ||
self.assertEqual( | ||
cve_change.created, datetime(2022, 3, 18, 20, 13, 8, 123000) | ||
cve_change.created, | ||
datetime(2022, 3, 18, 20, 13, 8, 123000, tzinfo=timezone.utc), | ||
) | ||
self.assertEqual( | ||
cve_change.details, | ||
|