mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Replace usages of os.rename with shutil.move to properly handle cases where the source and dest arent't on the same filesystem
This commit is contained in:

committed by
Trenton H

parent
613b71d23b
commit
b7577038a0
@@ -697,7 +697,7 @@ class TestFileHandlingWithArchive(DirectoriesMixin, FileSystemAssertsMixin, Test
|
||||
self.assertIsFile(doc.archive_path)
|
||||
|
||||
@override_settings(FILENAME_FORMAT="{correspondent}/{title}")
|
||||
@mock.patch("documents.signals.handlers.os.rename")
|
||||
@mock.patch("documents.signals.handlers.shutil.move")
|
||||
def test_move_archive_error(self, m):
|
||||
def fake_rename(src, dst):
|
||||
if "archive" in str(src):
|
||||
@@ -748,7 +748,7 @@ class TestFileHandlingWithArchive(DirectoriesMixin, FileSystemAssertsMixin, Test
|
||||
self.assertIsFile(doc.archive_path)
|
||||
|
||||
@override_settings(FILENAME_FORMAT="{correspondent}/{title}")
|
||||
@mock.patch("documents.signals.handlers.os.rename")
|
||||
@mock.patch("documents.signals.handlers.shutil.move")
|
||||
def test_move_file_error(self, m):
|
||||
def fake_rename(src, dst):
|
||||
if "original" in str(src):
|
||||
|
Reference in New Issue
Block a user