added time to all events. this is a unix timestamp so will need to be converted to something nicer if dispalyed, but hey, its easy to store

This commit is contained in:
PatchOfScotland
2023-04-27 15:13:47 +02:00
parent d3eb2dbf9f
commit 933d568fb2
13 changed files with 210 additions and 143 deletions

View File

@ -3,20 +3,21 @@ import unittest
import os
from datetime import datetime
from time import time
from typing import Any, Union
from meow_base.core.meow import valid_event, valid_job, \
valid_watchdog_event
from meow_base.core.meow import valid_event, valid_job
from meow_base.functionality.validation import check_type, \
check_implementation, valid_string, valid_dict, valid_list, \
valid_existing_file_path, valid_dir_path, valid_non_existing_path, \
check_callable, valid_natural, valid_dict_multiple_types
from meow_base.core.vars import VALID_NAME_CHARS, SHA256, \
EVENT_TYPE, EVENT_PATH, JOB_TYPE, JOB_EVENT, JOB_ID, JOB_PATTERN, \
JOB_RECIPE, JOB_RULE, JOB_STATUS, JOB_CREATE_TIME, EVENT_RULE, \
WATCHDOG_BASE, WATCHDOG_HASH
JOB_RECIPE, JOB_RULE, JOB_STATUS, JOB_CREATE_TIME, EVENT_RULE, EVENT_TIME
from meow_base.functionality.file_io import make_dir
from meow_base.functionality.meow import create_rule
from meow_base.patterns.file_event_pattern import WATCHDOG_BASE, \
WATCHDOG_HASH, valid_watchdog_event
from shared import TEST_MONITOR_BASE, valid_pattern_one, valid_recipe_one, \
setup, teardown
@ -313,12 +314,14 @@ class MeowTests(unittest.TestCase):
valid_event({
EVENT_TYPE: "test",
EVENT_PATH: "path",
EVENT_RULE: rule
EVENT_RULE: rule,
EVENT_TIME: time()
})
valid_event({
EVENT_TYPE: "anything",
EVENT_PATH: "path",
EVENT_RULE: rule,
EVENT_TIME: time(),
"a": 1
})
@ -361,6 +364,7 @@ class MeowTests(unittest.TestCase):
EVENT_TYPE: "test",
EVENT_PATH: "path",
EVENT_RULE: rule,
EVENT_TIME: time(),
WATCHDOG_HASH: "hash",
WATCHDOG_BASE: "base"
})
@ -369,7 +373,8 @@ class MeowTests(unittest.TestCase):
valid_watchdog_event({
EVENT_TYPE: "test",
EVENT_PATH: "path",
EVENT_RULE: "rule"
EVENT_RULE: "rule",
EVENT_TIME: time()
})
with self.assertRaises(KeyError):
@ -377,6 +382,7 @@ class MeowTests(unittest.TestCase):
EVENT_TYPE: "anything",
EVENT_PATH: "path",
EVENT_RULE: "rule",
EVENT_TIME: time(),
"a": 1
})