diff options
| author | J08nY | 2024-02-14 12:58:21 +0100 |
|---|---|---|
| committer | J08nY | 2024-02-14 12:58:21 +0100 |
| commit | d73ddbcdfcd0768c9e594f627947eac87f1d561b (patch) | |
| tree | 8f210ed79aaad0a06f1c087b0383e03c6c489691 /tests/cc | |
| parent | 05afc93e597564f802d36ef56ccdbf8108967dd2 (diff) | |
| download | sec-certs-d73ddbcdfcd0768c9e594f627947eac87f1d561b.tar.gz sec-certs-d73ddbcdfcd0768c9e594f627947eac87f1d561b.tar.zst sec-certs-d73ddbcdfcd0768c9e594f627947eac87f1d561b.zip | |
Add tests for cert data extraction.
Diffstat (limited to 'tests/cc')
| -rw-r--r-- | tests/cc/test_cc_dataset.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/cc/test_cc_dataset.py b/tests/cc/test_cc_dataset.py index 4fe40a40..9d1e4022 100644 --- a/tests/cc/test_cc_dataset.py +++ b/tests/cc/test_cc_dataset.py @@ -23,6 +23,12 @@ def test_download_and_convert_pdfs(toy_dataset: CCDataset, data_dir: Path): "8a5e6bcda602920c": "fcee91f09bb72a6526a1f94d0ab754a6db3fbe3ba5773cd372df19788bb25292", } + template_cert_pdf_hashes = { + "309ac2fd7f2dcf17": "9d38bca310c4d349cc39471e0b75d939cc275db9a75b07b8a365d719cfbedcc5", + "8cf86948f02f047d": None, + "8a5e6bcda602920c": "4ba78f26f505819183256ca5a6b404fa90c750fe160c41791e4c400f64e2f6d5", + } + with TemporaryDirectory() as td: toy_dataset.copy_dataset(td) toy_dataset.download_all_artifacts() @@ -30,10 +36,12 @@ def test_download_and_convert_pdfs(toy_dataset: CCDataset, data_dir: Path): if not ( toy_dataset["309ac2fd7f2dcf17"].state.report.download_ok or toy_dataset["309ac2fd7f2dcf17"].state.st.download_ok + or toy_dataset["309ac2fd7f2dcf17"].state.cert.download_ok or toy_dataset["8cf86948f02f047d"].state.report.download_ok or toy_dataset["8cf86948f02f047d"].state.st.download_ok or toy_dataset["8a5e6bcda602920c"].state.report.download_ok or toy_dataset["8a5e6bcda602920c"].state.st.download_ok + or toy_dataset["8a5e6bcda602920c"].state.cert.download_ok ): pytest.xfail(reason="Fail due to error during download") @@ -42,12 +50,15 @@ def test_download_and_convert_pdfs(toy_dataset: CCDataset, data_dir: Path): for cert in toy_dataset: assert cert.state.report.pdf_hash == template_report_pdf_hashes[cert.dgst] assert cert.state.st.pdf_hash == template_st_pdf_hashes[cert.dgst] + assert cert.state.cert.pdf_hash == template_cert_pdf_hashes[cert.dgst] assert not cert.state.report.convert_garbage assert not cert.state.st.convert_garbage assert cert.state.report.convert_ok assert cert.state.st.convert_ok assert cert.state.report.txt_path.exists() assert cert.state.st.txt_path.exists() + if cert.cert_link: + assert cert.state.cert.txt_path.exists() template_report_txt_path = data_dir / "report_309ac2fd7f2dcf17.txt" template_st_txt_path = data_dir / "target_309ac2fd7f2dcf17.txt" |
