changeset 484:ddfabe1fbee1

new tests for DelayedDeletion plugin
author Alain Mazy <am@osimis.io>
date Wed, 22 Jun 2022 16:06:46 +0200
parents 45c3fe035fed
children 459eb688d3a1
files NewTests/DelayedDeletion/test_delayed_deletion.py NewTests/helpers.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NewTests/DelayedDeletion/test_delayed_deletion.py	Wed Jun 22 15:45:31 2022 +0200
+++ b/NewTests/DelayedDeletion/test_delayed_deletion.py	Wed Jun 22 16:06:46 2022 +0200
@@ -106,4 +106,7 @@
             plugin_status = self.o.get_json("/plugins/delayed-deletion/status")
             completed = plugin_status["FilesPendingDeletion"] == 0
 
-        self.assertTrue(completed)
\ No newline at end of file
+        self.assertTrue(completed)
+        files_count_after_delayed_deletion_is_complete = len(glob.glob(os.path.join(self.get_storage_path("DelayedDeletion"), "**"), recursive=True))
+        self.assertGreater(10, files_count_after_delayed_deletion_is_complete)  # only the sqlite files shall remain (and . and ..)
+
--- a/NewTests/helpers.py	Wed Jun 22 15:45:31 2022 +0200
+++ b/NewTests/helpers.py	Wed Jun 22 16:06:46 2022 +0200
@@ -188,13 +188,14 @@
 
     @classmethod
     def launch_orthanc_docker(cls, docker_image: str, storage_name: str, config_path: str, config_name: str):
+            storage_path = cls.get_storage_path(storage_name=storage_name)
 
             cmd = [
                     "docker", "run", "--rm", 
                     "-e", "VERBOSE_ENABLED=true",
                     "-e", "VERBOSE_STARTUP=true", 
                     "-v", f"{config_path}:/etc/orthanc/orthanc.json",
-                    "-v", f"{storage_name}:/var/lib/orthanc/db/",
+                    "-v", f"{storage_path}:/var/lib/orthanc/db/",
                     "--name", config_name,
                     "-p", f"{Helpers.orthanc_under_tests_http_port}:{Helpers.orthanc_under_tests_http_port}",
                     "-p", f"{Helpers.orthanc_under_tests_dicom_port}:{Helpers.orthanc_under_tests_dicom_port}",