当前位置: 首页>>代码示例>>Python>>正文


Python DeliveryFactory.build_contact方法代码示例

本文整理汇总了Python中eums.test.factories.delivery_factory.DeliveryFactory.build_contact方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryFactory.build_contact方法的具体用法?Python DeliveryFactory.build_contact怎么用?Python DeliveryFactory.build_contact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eums.test.factories.delivery_factory.DeliveryFactory的用法示例。


在下文中一共展示了DeliveryFactory.build_contact方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_should_dequeue_next_run_in_the_queue

# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import build_contact [as 别名]
    def test_should_dequeue_next_run_in_the_queue(self):
        first_delivery_to_be_answered = DeliveryFactory(track=True)
        contact = {'name': 'Some name', 'phone': '098765433'}
        first_delivery_to_be_answered.build_contact = MagicMock(return_value=contact)
        self._schedule_run_for(first_delivery_to_be_answered)
        second_delivery_to_be_answered = DeliveryFactory(track=True)
        self._schedule_run_for(second_delivery_to_be_answered)

        data = {
            'runnable': first_delivery_to_be_answered.id, 'answers': [
                {'question_label': 'deliveryReceived', 'value': 'Yes'}]
        }

        next_run = RunQueue.objects.filter(
            Q(contact_person_id=second_delivery_to_be_answered.contact_person_id) & Q(
                status='not_started')).order_by(
            '-run_delay').first()
        self.client.post(ENDPOINT_URL, data=json.dumps(data), content_type='application/json')

        first_runs = Run.objects.filter(runnable=first_delivery_to_be_answered)
        next_run = RunQueue.objects.get(id=next_run.id)

        self.assertEqual(len(first_runs), 2)
        self.assertEqual(next_run.status, 'started')
        self.assertTrue(self.mock_distribution_alert_raise.delay.called)
开发者ID:unicefuganda,项目名称:eums,代码行数:27,代码来源:test_web_answers_end_point.py

示例2: test_should_schedule_implementing_partner_flow_if_runnable_is_delivery

# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import build_contact [as 别名]
    def test_should_schedule_implementing_partner_flow_if_runnable_is_delivery(self):
        delivery = DeliveryFactory()
        NodeFactory(distribution_plan=delivery, item=PurchaseOrderItemFactory())
        delivery.build_contact = MagicMock(return_value=self.contact)

        Runnable.objects.get = MagicMock(return_value=delivery)

        schedule_run_for(delivery)

        mock_start_delivery_run.assert_called_with(contact_person=self.contact, flow=self.IMPLEMENTING_PARTNER_FLOW_ID,
                                                   item_description=ANY, sender=ANY)
开发者ID:phoenix-zhu,项目名称:eums,代码行数:13,代码来源:test_flow_scheduler.py

示例3: test_should_schedule_implementing_partner_flow_if_runnable_is_delivery

# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import build_contact [as 别名]
    def test_should_schedule_implementing_partner_flow_if_runnable_is_delivery(self):
        delivery = DeliveryFactory()
        NodeFactory(distribution_plan=delivery, item=PurchaseOrderItemFactory())
        delivery.build_contact = MagicMock(return_value=self.contact)

        Runnable.objects.get = MagicMock(return_value=delivery)

        self.flow_scheduler.schedule_run_for(delivery)

        self.mocked_create_run.assert_called_with(self.contact, self.ip_flow,
                                                  ANY, ANY)
开发者ID:raymondyan,项目名称:eums,代码行数:13,代码来源:test_flow_scheduler.py


注:本文中的eums.test.factories.delivery_factory.DeliveryFactory.build_contact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。