Ejemplo n.º 1
0
def create(context):
    check_recipients(context.form)

    logic_task = postponed_tasks.SendMessagesTask(account_id=context.account.id,
                                                  recipients=context.form.c.recipients,
                                                  message=context.form.c.text)

    task = PostponedTaskPrototype.create(logic_task)

    amqp_environment.environment.workers.accounts_manager.cmd_task(task.id)

    return dext_views.AjaxProcessing(status_url=task.status_url)
Ejemplo n.º 2
0
    def setUp(self):
        super(TaskTests, self).setUp()

        create_test_map()

        self.good_1_uid = 'good-1'

        self.account_1 = self.accounts_factory.create_account()
        self.account_2 = self.accounts_factory.create_account()
        self.account_3 = self.accounts_factory.create_account()

        self.task = postponed_tasks.SendMessagesTask(account_id=self.account_2.id,
                                                     recipients=[self.account_1.id, self.account_3.id],
                                                     message=u'test-message')

        self.main_task = mock.Mock(comment=None, id=777)