mirror of
https://github.com/Dineshkarthik/telegram_media_downloader.git
synced 2024-12-27 09:11:56 +08:00
test: unittest cases for log handler
This commit is contained in:
parent
42118052bd
commit
1e3d7db193
1 changed files with 30 additions and 0 deletions
30
tests/utils/test_log.py
Normal file
30
tests/utils/test_log.py
Normal 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)
|
Loading…
Reference in a new issue