本文整理汇总了Python中temba.flows.models.Flow.export_definitions方法的典型用法代码示例。如果您正苦于以下问题:Python Flow.export_definitions方法的具体用法?Python Flow.export_definitions怎么用?Python Flow.export_definitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类temba.flows.models.Flow
的用法示例。
在下文中一共展示了Flow.export_definitions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_export_import
# 需要导入模块: from temba.flows.models import Flow [as 别名]
# 或者: from temba.flows.models.Flow import export_definitions [as 别名]
def test_export_import(self):
# tweak our current channel to be twitter so we can create a channel-based trigger
Channel.objects.filter(id=self.channel.id).update(channel_type=TWITTER)
flow = self.create_flow()
group = self.create_group("Trigger Group", [])
# create a trigger on this flow for the follow actions but only on some groups
trigger = Trigger.objects.create(org=self.org, flow=flow, trigger_type=Trigger.TYPE_FOLLOW, channel=self.channel,
created_by=self.admin, modified_by=self.admin)
trigger.groups.add(group)
# export everything
export = Flow.export_definitions([flow])
# remove our trigger
Trigger.objects.all().delete()
# and reimport them.. trigger should be recreated
self.org.import_app(export, self.admin)
trigger = Trigger.objects.get()
self.assertEqual(trigger.trigger_type, Trigger.TYPE_FOLLOW)
self.assertEqual(trigger.flow, flow)
self.assertEqual(trigger.channel, self.channel)
self.assertEqual(list(trigger.groups.all()), [group])