diff options
Diffstat (limited to '')
-rw-r--r-- | test/unit/applications/proto.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py new file mode 100644 index 00000000..17dfed35 --- /dev/null +++ b/test/unit/applications/proto.py @@ -0,0 +1,15 @@ +import re +import time +from unit.control import TestControl + + +class TestApplicationProto(TestControl): + def sec_epoch(self): + return time.mktime(time.gmtime()) + + def date_to_sec_epoch(self, date, template='%a, %d %b %Y %H:%M:%S %Z'): + return time.mktime(time.strptime(date, template)) + + def search_in_log(self, pattern): + with open(self.testdir + '/unit.log', 'r', errors='ignore') as f: + return re.search(pattern, f.read()) |