From 01329a916aee3691fd23a5c556d2f3f3f1ba14ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Mon, 27 Feb 2023 11:24:03 +0100
Subject: [PATCH] FIX: move test for remove_prefix to int tests

---
 .../test_use_case_simple_presentation.py          | 15 ++++++++++++---
 unittests/test_tool.py                            | 13 -------------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/integrationtests/test_use_case_simple_presentation.py b/integrationtests/test_use_case_simple_presentation.py
index 4b006bd6..5fc0f6c7 100644
--- a/integrationtests/test_use_case_simple_presentation.py
+++ b/integrationtests/test_use_case_simple_presentation.py
@@ -38,9 +38,7 @@ DATADIR = os.path.join(os.path.dirname(__file__), "test_data",
                        "extroot", "use_case_simple_presentation")
 
 
-def test_complete_crawler(
-        clear_database
-):
+def test_complete_crawler(clear_database):
     # Setup the data model:
     model = parser.parse_model_from_yaml(os.path.join(DATADIR, "model.yml"))
     model.sync_data_model(noquestion=True, verbose=False)
@@ -57,6 +55,17 @@ def test_complete_crawler(
             dryrun=False,
             forceAllowSymlinks=False)
 
+    # test that a bad value for "remove_prefix" leads to runtime error
+    with pytest.raises(RuntimeError) as re:
+        crawler_main(DATADIR,
+                     os.path.join(DATADIR, "cfood.yml"),
+                     os.path.join(DATADIR, "identifiables.yml"),
+                     True,
+                     os.path.join(DATADIR, "provenance.yml"),
+                     False,
+                     remove_prefix="sldkfjsldf")
+    assert "path does not start with the prefix" in str(re.value)
+
     crawler_main(DATADIR,
                  os.path.join(DATADIR, "cfood.yml"),
                  os.path.join(DATADIR, "identifiables.yml"),
diff --git a/unittests/test_tool.py b/unittests/test_tool.py
index e8bf23cf..af84f8fd 100755
--- a/unittests/test_tool.py
+++ b/unittests/test_tool.py
@@ -982,16 +982,3 @@ def test_deprecated_prefix_option():
                      remove_prefix="to/be/removed")
 
     assert "(deprecated) `prefix` and the `remove_prefix`" in str(ve.value)
-
-
-def test_wrong_remove_prefix_option():
-    """Test that calling the crawler's main function with `remove_prefix` option
-    with a bad value raises the correct error.
-    """
-
-    with raises(RuntimeError) as re:
-        crawler_main(rfp("test_directories", "examples_article"),
-                     rfp("scifolder_extended.yml"),
-                     remove_prefix="to/be/removed")
-
-    assert "path does not start with the prefix" in str(re.value)
-- 
GitLab