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. --- tests/test_cc_oop.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/test_cc_oop.py') 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 From 9ab303782d468a96116ab393615f31c6389d9ab6 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Wed, 5 Jan 2022 11:14:38 +0100 Subject: fix assert in test --- tests/test_cc_oop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_cc_oop.py') diff --git a/tests/test_cc_oop.py b/tests/test_cc_oop.py index e4bb4482..c2a9223b 100644 --- a/tests/test_cc_oop.py +++ b/tests/test_cc_oop.py @@ -162,7 +162,7 @@ class TestCommonCriteriaOOP(TestCase): out = json.load(f) with open(self.test_data_dir / "fictional_cert.json") as f: template = json.load(f) - assert out == template + self.assertEqual(out, template, "Serialized cert differs from cert json template.") def test_dataset_to_json(self): with NamedTemporaryFile("w") as tmp: -- cgit v1.3.1