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


Python DeliveryNodeFactory.build_contact方法代码示例

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


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

示例1: test_should_schedule_flow_to_start_after_buffer_when_calculated_send_time_is_in_past

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_flow_to_start_after_buffer_when_calculated_send_time_is_in_past(self):
        some_date = FakeDate.today() - datetime.timedelta(days=10)
        node = NodeFactory(delivery_date=some_date)
        node.build_contact = MagicMock(return_value=self.contact)

        schedule_run_for(node)

        self.assertEqual(mock_celery.invoked_after, 10.0)
开发者ID:phoenix-zhu,项目名称:eums,代码行数:10,代码来源:test_flow_scheduler.py

示例2: test_should_queue_run_for_a_contact_if_contact_has_current_run_for_a_different_runnable

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_queue_run_for_a_contact_if_contact_has_current_run_for_a_different_runnable(self,
                                                                                                mock_run_queue_enqueue):
        RunFactory(runnable=self.node)
        node_two = NodeFactory(contact_person_id=self.node.contact_person_id)
        node_two.build_contact = MagicMock(return_value=self.contact)
        mock_run_queue_enqueue.return_value = None
        schedule_run_for(node_two)

        mock_run_queue_enqueue.assert_called_with(node_two, ANY)
开发者ID:phoenix-zhu,项目名称:eums,代码行数:11,代码来源:test_flow_scheduler.py

示例3: test_should_schedule_end_user_flow_if_node_tree_position_is_end_user

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_end_user_flow_if_node_tree_position_is_end_user(self):
        node = NodeFactory(tree_position=Node.END_USER)
        node.build_contact = MagicMock(return_value=self.contact)

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

        self.flow_scheduler.schedule_run_for(node)

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

示例4: test_should_schedule_middleman_flow_if_node_tree_position_is_middleman

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_middleman_flow_if_node_tree_position_is_middleman(self):
        node = NodeFactory(tree_position=Node.MIDDLE_MAN)
        node.build_contact = MagicMock(return_value=self.contact)

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

        self.flow_scheduler.schedule_run_for(node)

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

示例5: test_should_schedule_end_user_flow_if_node_tree_position_is_end_user

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_end_user_flow_if_node_tree_position_is_end_user(self):
        node = NodeFactory(tree_position=Node.END_USER)
        node.build_contact = MagicMock(return_value=self.contact)

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

        schedule_run_for(node)

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

示例6: test_should_build_contact_with_details_from_contacts_service

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_build_contact_with_details_from_contacts_service(self, mock_get):
        contact_id = '54335c56b3ae9d92f038abb0'
        fake_contact_json = {'firstName': "test", 'lastName': "user1", 'phone': "+256 782 443439", '_id': contact_id}
        fake_response = FakeResponse(fake_contact_json, 200)
        node = NodeFactory(contact_person_id=contact_id)
        mock_get.return_value = fake_response

        contact = node.build_contact()

        self.assertEqual(contact, fake_contact_json)
        mock_get.assert_called_with("%s%s/" % (settings.CONTACTS_SERVICE_URL, contact_id))
开发者ID:v55448330,项目名称:eums,代码行数:13,代码来源:test_runnable.py

示例7: test_should_schedule_flow_with_sender_as_parent_node_consignee_name_if_node_has_parent

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_flow_with_sender_as_parent_node_consignee_name_if_node_has_parent(self):
        sender_org_name = "Dwelling Places"
        sender_org = ConsigneeFactory(name=sender_org_name)
        parent_node = NodeFactory(consignee=sender_org)
        node = NodeFactory(consignee=sender_org, parents=[(parent_node, 10)])
        node.build_contact = MagicMock(return_value=self.contact)

        Runnable.objects.get = MagicMock(return_value=node)
        node.consignee.build_contact = MagicMock(return_value=self.contact)

        self.flow_scheduler.schedule_run_for(node)

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

示例8: test_should_schedule_flow_with_sender_as_parent_node_consignee_name_if_node_has_parent

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import build_contact [as 别名]
    def test_should_schedule_flow_with_sender_as_parent_node_consignee_name_if_node_has_parent(self):
        sender_org_name = "Dwelling Places"
        sender_org = ConsigneeFactory(name=sender_org_name)
        parent_node = NodeFactory(consignee=sender_org)
        node = NodeFactory(consignee=sender_org, parents=[(parent_node, 10)])
        node.build_contact = MagicMock(return_value=self.contact)

        Runnable.objects.get = MagicMock(return_value=node)
        node.consignee.build_contact = MagicMock(return_value=self.contact)

        schedule_run_for(node)

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


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