]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix tests
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 7 Nov 2024 18:32:15 +0000 (10:32 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Thu, 7 Nov 2024 18:32:15 +0000 (10:32 -0800)
src/documents/tests/utils.py
src/paperless/tests/test_checks.py

index d2a1724db579e5069d9c666e41fdbe661b6d2fad..b1deac021c9fe07bb42769f176e2d270183a567c 100644 (file)
@@ -35,7 +35,7 @@ def setup_directories():
     dirs.scratch_dir = Path(tempfile.mkdtemp())
     dirs.media_dir = Path(tempfile.mkdtemp())
     dirs.consumption_dir = Path(tempfile.mkdtemp())
-    dirs.consumption_failed_dir = dirs.consumption_dir / "failed"
+    dirs.consumption_failed_dir = Path(tempfile.mkdtemp("failed"))
     dirs.static_dir = Path(tempfile.mkdtemp())
     dirs.index_dir = dirs.data_dir / "index"
     dirs.originals_dir = dirs.media_dir / "documents" / "originals"
index d2ea9102bd9578df2a7d5edb6331e312203a3eaf..548b1d3715149fc872e7754d5d731b0e90723007 100644 (file)
@@ -29,10 +29,11 @@ class TestChecks(DirectoriesMixin, TestCase):
         MEDIA_ROOT="uuh",
         DATA_DIR="whatever",
         CONSUMPTION_DIR="idontcare",
+        CONSUMPTION_FAILED_DIR="nope",
     )
     def test_paths_check_dont_exist(self):
         msgs = paths_check(None)
-        self.assertEqual(len(msgs), 3, str(msgs))
+        self.assertEqual(len(msgs), 4, str(msgs))
 
         for msg in msgs:
             self.assertTrue(msg.msg.endswith("is set but doesn't exist."))
@@ -41,13 +42,15 @@ class TestChecks(DirectoriesMixin, TestCase):
         os.chmod(self.dirs.data_dir, 0o000)
         os.chmod(self.dirs.media_dir, 0o000)
         os.chmod(self.dirs.consumption_dir, 0o000)
+        os.chmod(self.dirs.consumption_failed_dir, 0o000)
 
         self.addCleanup(os.chmod, self.dirs.data_dir, 0o777)
         self.addCleanup(os.chmod, self.dirs.media_dir, 0o777)
         self.addCleanup(os.chmod, self.dirs.consumption_dir, 0o777)
+        self.addCleanup(os.chmod, self.dirs.consumption_failed_dir, 0o777)
 
         msgs = paths_check(None)
-        self.assertEqual(len(msgs), 3)
+        self.assertEqual(len(msgs), 4)
 
         for msg in msgs:
             self.assertTrue(msg.msg.endswith("is not writeable"))