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:27:40 -04:00
parent 7672aca7a9
commit f77f64cc71
5 changed files with 108 additions and 94 deletions
@@ -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()