]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
codestyle
authorjonaswinkler <17569239+jonaswinkler@users.noreply.github.com>
Wed, 19 May 2021 18:26:12 +0000 (20:26 +0200)
committerjonaswinkler <17569239+jonaswinkler@users.noreply.github.com>
Wed, 19 May 2021 18:26:12 +0000 (20:26 +0200)
src/documents/consumer.py
src/documents/tests/test_consumer.py

index b6a77cd9c7247bfabc9fb9760f2d55fcd271eb8f..39275cee32eb96766587f5158899116608a2fc5a 100644 (file)
@@ -334,7 +334,10 @@ class Consumer(LoggingMixin):
                 os.unlink(self.path)
 
                 # https://github.com/jonaswinkler/paperless-ng/discussions/1037
-                shadow_file = os.path.join(os.path.dirname(self.path), "._" + os.path.basename(self.path))
+                shadow_file = os.path.join(
+                    os.path.dirname(self.path),
+                    "._" + os.path.basename(self.path))
+
                 if os.path.isfile(shadow_file):
                     self.log("debug", "Deleting file {}".format(shadow_file))
                     os.unlink(shadow_file)
index b1e0375ed2f78864cb15579b80bb36acf8dfcc62..514c3ca19e4927c8ddbb6101ca18469704596432 100644 (file)
@@ -322,9 +322,11 @@ class TestConsumer(DirectoriesMixin, TestCase):
         # https://github.com/jonaswinkler/paperless-ng/discussions/1037
 
         filename = self.get_test_file()
-        shadowFile = os.path.join(os.path.dirname(filename), "._" + os.path.basename(filename))
+        shadow_file = os.path.join(self.dirs.scratch_dir, "._sample.pdf")
 
-        shutil.copy(filename, shadowFile)
+        shutil.copy(filename, shadow_file)
+
+        self.assertTrue(os.path.isfile(shadow_file))
 
         document = self.consumer.try_consume_file(filename)
 
@@ -332,7 +334,7 @@ class TestConsumer(DirectoriesMixin, TestCase):
             document.source_path
         ))
 
-        self.assertFalse(os.path.isfile(shadowFile))
+        self.assertFalse(os.path.isfile(shadow_file))
         self.assertFalse(os.path.isfile(filename))