added tests for handlers and conductors validating events and jobs

This commit is contained in:
PatchOfScotland
2023-02-09 17:29:21 +01:00
parent abffeed9db
commit c0411c43a4
6 changed files with 203 additions and 20 deletions

View File

@ -101,12 +101,17 @@ class PythonHandler(BaseHandler):
Python recipes"""
try:
valid_event(event)
if event[EVENT_TYPE] == EVENT_TYPE_WATCHDOG \
and type(event[EVENT_RULE].recipe) == PythonRecipe:
msg = ""
if type(event[EVENT_RULE].recipe) != PythonRecipe:
msg = "Recipe is not a PythonRecipe. "
if event[EVENT_TYPE] != EVENT_TYPE_WATCHDOG:
msg += f"Event type is not {EVENT_TYPE_WATCHDOG}."
if msg:
return False, msg
else:
return True, ""
except Exception as e:
pass
return False, str(e)
return False, str(e)
def _is_valid_job_queue_dir(self, job_queue_dir)->None:
"""Validation check for 'job_queue_dir' variable from main