Esempio n. 1
0
 def test_declare_task(self):
     app = WorkerApplication()
     app.declare_taskgroup('testgroup', 'testexchange', 'testroutingkey')
     app.tasks = MagicMock()
     app.declare_task('testgroup', 'taskname')
     app.tasks._declare.assert_called_with('taskname',
                                           exchange='testexchange',
                                           routing_key='testroutingkey')
Esempio n. 2
0
 def test_register_task(self):
     @taskgroup('testgroup')
     def func1():
         pass
     def func2():
         pass
     app = WorkerApplication()
     app.declare_taskgroup('testgroup', 'testexchange', 'testroutingkey')
     app.tasks = MagicMock()
     app.register_task(func1, 'funcone')
     app.tasks._set.assert_called_with(func1, 'funcone',
                                       exchange='testexchange',
                                       routing_key='testroutingkey')
     app.register_task(func2, taskgroup='testgroup')
     app.tasks._set.assert_called_with(func2, 'func2',
                                       exchange='testexchange',
                                       routing_key='testroutingkey')