2026-04-24 20:19:11 +03:00
|
|
|
__author__ = 'RemiZOffAlex'
|
|
|
|
|
__email__ = 'remizoffalex@mail.ru'
|
|
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
2026-04-24 20:20:41 +03:00
|
|
|
from router.dispatcher import Dispacher
|
2026-04-24 20:19:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def comparator(params):
|
|
|
|
|
return 'param' in params
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action(params):
|
|
|
|
|
return params['param']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestDispatcher(unittest.TestCase):
|
|
|
|
|
def test_dispatcher(self):
|
|
|
|
|
dispacher = Dispatcher()
|
|
|
|
|
params ={'param': True}
|
|
|
|
|
dispatcher.register('name', comparator, action)
|
|
|
|
|
result = dispatcher(params)
|
|
|
|
|
self.assertTrue(result)
|