From 7a4fed73fa1bf77e9affc8ca2adde9d807adafb0 Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 5 Jan 2022 01:02:56 +0100 Subject: Fix from_dict ordering issue. --- .../test_cc_heuristics/auxillary_datasets/cve_dataset.json | 8 ++++---- tests/data/test_cc_heuristics/dependency_dataset.json | 3 --- tests/data/test_cc_oop/fictional_cert.json | 8 ++++---- tests/test_cc_oop.py | 10 ++++++---- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/data/test_cc_heuristics/auxillary_datasets/cve_dataset.json b/tests/data/test_cc_heuristics/auxillary_datasets/cve_dataset.json index 6bdd4dc7..c74cd5cb 100644 --- a/tests/data/test_cc_heuristics/auxillary_datasets/cve_dataset.json +++ b/tests/data/test_cc_heuristics/auxillary_datasets/cve_dataset.json @@ -17,10 +17,10 @@ "_type": "Impact", "base_score": 5.3, "severity": "MEDIUM", - "explotability_score": 3.9, + "exploitability_score": 3.9, "impact_score": 1.4 }, - "publishedDate": "2021-05-26T04:15Z" + "published_date": "2021-05-26T04:15Z" }, "CVE-2019-4513": { "_type": "CVE", @@ -38,10 +38,10 @@ "_type": "Impact", "base_score": 8.2, "severity": "HIGH", - "explotability_score": 3.9, + "exploitability_score": 3.9, "impact_score": 4.2 }, - "publishedDate": "2000-05-26T04:15Z" + "published_date": "2000-05-26T04:15Z" } } } diff --git a/tests/data/test_cc_heuristics/dependency_dataset.json b/tests/data/test_cc_heuristics/dependency_dataset.json index 8e106a03..7e226577 100644 --- a/tests/data/test_cc_heuristics/dependency_dataset.json +++ b/tests/data/test_cc_heuristics/dependency_dataset.json @@ -325,7 +325,6 @@ "10.1.5" ], "cpe_matches": null, - "labeled": false, "verified_cpe_matches": null, "related_cves": null, "cert_lab": [ @@ -676,7 +675,6 @@ "9.1.6" ], "cpe_matches": null, - "labeled": false, "verified_cpe_matches": null, "related_cves": null, "cert_lab": [ @@ -1028,7 +1026,6 @@ "8.1.10" ], "cpe_matches": null, - "labeled": false, "verified_cpe_matches": null, "related_cves": null, "cert_lab": [ diff --git a/tests/data/test_cc_oop/fictional_cert.json b/tests/data/test_cc_oop/fictional_cert.json index 45c1b5a4..56bea187 100644 --- a/tests/data/test_cc_oop/fictional_cert.json +++ b/tests/data/test_cc_oop/fictional_cert.json @@ -11,9 +11,6 @@ ], "not_valid_before": "1900-01-02", "not_valid_after": "1900-01-03", - "report_link": "https://path.to/report/link", - "st_link": "https://path.to/st/link", - "cert_link": "https://path.to/cert/link", "manufacturer_web": "https://path.to/manufacturer/web", "protection_profiles": [ { @@ -63,5 +60,8 @@ "indirectly_affected_by": null, "directly_affecting": null, "indirectly_affecting": null - } + }, + "report_link": "https://path.to/report/link", + "st_link": "https://path.to/st/link", + "cert_link": "https://path.to/cert/link" } \ No newline at end of file diff --git a/tests/test_cc_oop.py b/tests/test_cc_oop.py index 2426476d..e4bb4482 100644 --- a/tests/test_cc_oop.py +++ b/tests/test_cc_oop.py @@ -1,4 +1,5 @@ import filecmp +import json import os import shutil import tempfile @@ -157,10 +158,11 @@ class TestCommonCriteriaOOP(TestCase): def test_cert_to_json(self): with NamedTemporaryFile("w") as tmp: self.fictional_cert.to_json(tmp.name) - self.assertTrue( - filecmp.cmp(self.test_data_dir / "fictional_cert.json", tmp.name), - "The sample serialized to json differs from a template.", - ) + with open(tmp.name) as f: + out = json.load(f) + with open(self.test_data_dir / "fictional_cert.json") as f: + template = json.load(f) + assert out == template def test_dataset_to_json(self): with NamedTemporaryFile("w") as tmp: -- cgit v1.3.1