From fb5877972fa6e76fc7b5f120b3b84b80caec88a5 Mon Sep 17 00:00:00 2001 From: Nora-Olivia-Ammann <103038637+Nora-Olivia-Ammann@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:41:50 +0100 Subject: [PATCH] chore(test): make integration test ingest-xmlupload (#843) Co-authored-by: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Co-authored-by: Johannes Nussbaum --- test/integration/commands/ingest_xmlupload/__init__.py | 0 .../commands/ingest_xmlupload/test_ingest_xmlupload.py | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 test/integration/commands/ingest_xmlupload/__init__.py rename test/{unittests => integration}/commands/ingest_xmlupload/test_ingest_xmlupload.py (90%) diff --git a/test/integration/commands/ingest_xmlupload/__init__.py b/test/integration/commands/ingest_xmlupload/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/unittests/commands/ingest_xmlupload/test_ingest_xmlupload.py b/test/integration/commands/ingest_xmlupload/test_ingest_xmlupload.py similarity index 90% rename from test/unittests/commands/ingest_xmlupload/test_ingest_xmlupload.py rename to test/integration/commands/ingest_xmlupload/test_ingest_xmlupload.py index 7a879a15b..0a62f6cbf 100644 --- a/test/unittests/commands/ingest_xmlupload/test_ingest_xmlupload.py +++ b/test/integration/commands/ingest_xmlupload/test_ingest_xmlupload.py @@ -3,6 +3,7 @@ from typing import Iterator import pytest +import regex from dsp_tools.commands.ingest_xmlupload.upload_xml import ingest_xmlupload from dsp_tools.models.exceptions import InputError @@ -18,7 +19,7 @@ def _retrieve_mapping_file() -> Iterator[None]: def test_ingest_xmlupload() -> None: - expected_msg = ( + expected_msg = regex.escape( "The upload cannot continue as there are problems with the multimedia files referenced in the XML.\n" " The data XML file does not reference the following multimedia files " "which were previously uploaded through dsp-ingest:\n" @@ -38,7 +39,8 @@ def test_ingest_xmlupload() -> None: def test_ingest_xmlupload_no_mapping() -> None: - with pytest.raises(InputError): + expected_msg = regex.escape("No mapping CSV file was found at mapping-00A5.csv.") + with pytest.raises(InputError, match=expected_msg): ingest_xmlupload( xml_file=Path("testdata/dsp-ingest-data/dsp_ingest_no_mapping.xml"), user="root@example.com",