aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Janovsky2020-11-27 11:14:19 +0100
committerAdam Janovsky2020-11-27 11:14:19 +0100
commit83c22746cb6f8bb7f5d5d90bb6b3155529c0c674 (patch)
tree3e56d033a4cae1b0d74e168ae9dc66c7023fb016
parent0ffa845fbb51f6ac1f7b4434b3a78cc4d7f38d22 (diff)
downloadsec-certs-83c22746cb6f8bb7f5d5d90bb6b3155529c0c674.tar.gz
sec-certs-83c22746cb6f8bb7f5d5d90bb6b3155529c0c674.tar.zst
sec-certs-83c22746cb6f8bb7f5d5d90bb6b3155529c0c674.zip
Fix cc_oop_test of pdf file conversion
It seems that pdftotext is not fully reproducible and gives platform specific results. So we dont check for full file equality, but rather for the existence of converted file. We further check that the created file size roughly matches the one freshly produced by Travis pdftotext.
-rw-r--r--test/test_cc_oop.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test_cc_oop.py b/test/test_cc_oop.py
index c643444b..4ad9b320 100644
--- a/test/test_cc_oop.py
+++ b/test/test_cc_oop.py
@@ -113,11 +113,12 @@ class TestCommonCriteriaOOP(TestCase):
self.assertEqual(actual_report_pdf_hashes, self.template_report_pdf_hashes, 'Hashes of downloaded pdfs (certificate report) do not the template')
self.assertEqual(actual_target_pdf_hashes, self.template_target_pdf_hashes, 'Hashes of downloaded pdfs (security target) do not match the template')
- self.assertTrue(filecmp.cmp(dset.report_txt_paths['869415cc4b91282e'], self.template_report_txt_path),
- 'The report of 869415cc4b91282e.pdf converted to txt does not match the template.')
- self.assertTrue(filecmp.cmp(dset.target_txt_paths['869415cc4b91282e'], self.template_target_txt_path),
- 'The target of 869415cc4b91282e.pdf converted to txt does not match the template.')
-
+ self.assertTrue(dset.report_txt_paths['869415cc4b91282e'].exists())
+ self.assertTrue(dset.target_txt_paths['869415cc4b91282e'].exists())
+ self.assertAlmostEqual(dset.target_txt_paths['869415cc4b91282e'].stat().st_size,
+ self.template_target_txt_path.stat().st_size, delta=1000)
+ self.assertAlmostEqual(dset.report_txt_paths['869415cc4b91282e'].stat().st_size,
+ self.template_report_txt_path.stat().st_size, delta=1000)
def test_cert_to_json(self):
self.assertTrue(self.equal_to_json(self.test_data_dir / 'fictional_cert.json', self.fictional_cert),