예제 #1
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.goods_1 = logic.load_goods(self.account_1.id)

        self.good_1 = goods_types.test_hero_good.create_good(self.good_1_uid)

        self.goods_1.add_good(self.good_1)
        logic.save_goods(self.goods_1)

        self.logic_storage = logic_storage.LogicStorage()
        self.logic_storage.load_account_data(self.account_1)

        self.price_1 = 666

        self.task = postponed_tasks.CreateLotTask(
            account_id=self.account_1.id,
            good_type=goods_types.test_hero_good.uid,
            good_uid=self.good_1_uid,
            price=self.price_1)

        self.main_task = mock.Mock(comment=None, id=777)
예제 #2
0
파일: logic.py 프로젝트: pavetok/the-tale
def send_good_to_market(seller_id, good, price):
    from the_tale.common.postponed_tasks import PostponedTaskPrototype
    from the_tale.finances.market import postponed_tasks

    logic_task = postponed_tasks.CreateLotTask(account_id=seller_id,
                                               good_type=good.type,
                                               good_uid=good.uid,
                                               price=price)

    task = PostponedTaskPrototype.create(logic_task)

    amqp_environment.environment.workers.market_manager.cmd_logic_task(
        seller_id, task.id)

    return task