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:
Roberto Rosario
2018-12-18 17:25:28 -04:00
committed by Roberto Rosario
parent d35323aa65
commit 382173351a
5 changed files with 108 additions and 94 deletions

View File

@@ -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()