test: unittest cases for log handler

This commit is contained in:
Dineshkarthik 2020-12-31 14:31:24 +01:00
parent 42118052bd
commit 1e3d7db193
No known key found for this signature in database
GPG key ID: E256EF0EECD6F201

30
tests/utils/test_log.py Normal file
View file

@ -0,0 +1,30 @@
"""Unittest module for log handlers."""
import os
import sys
import unittest
import mock
sys.path.append("..") # Adds higher directory to python modules path.
from utils.log import LogFilter
class MockLog:
"""
Mock logs.
"""
def __init__(self, **kwargs):
self.funcName = kwargs["funcName"]
class MetaTestCase(unittest.TestCase):
def test_log_filter(self):
result = LogFilter().filter(MockLog(funcName="send"))
self.assertEqual(result, False)
result1 = LogFilter().filter(MockLog(funcName="get_file"))
self.assertEqual(result1, False)
result2 = LogFilter().filter(MockLog(funcName="Synced"))
self.assertEqual(result2, True)