Source: Change source test behavior
Update sourcs to accept a test argument to their check methods. This is to allow for explicit test behavior like running the check method code even when the source is disabled and to not deleted downloaded content during a test. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -46,7 +46,7 @@ class WatchFolderSource(IntervalBaseModel):
|
||||
verbose_name = _('Watch folder')
|
||||
verbose_name_plural = _('Watch folders')
|
||||
|
||||
def check_source(self):
|
||||
def check_source(self, test=False):
|
||||
path = Path(self.folder_path)
|
||||
|
||||
if self.include_subdirectories:
|
||||
@@ -62,4 +62,5 @@ class WatchFolderSource(IntervalBaseModel):
|
||||
expand=(self.uncompress == SOURCE_UNCOMPRESS_CHOICE_Y),
|
||||
label=entry.name
|
||||
)
|
||||
entry.unlink()
|
||||
if not test:
|
||||
entry.unlink()
|
||||
|
||||
Reference in New Issue
Block a user