本文整理匯總了Python中st2common.persistence.trace.Trace.push_rule方法的典型用法代碼示例。如果您正苦於以下問題:Python Trace.push_rule方法的具體用法?Python Trace.push_rule怎麽用?Python Trace.push_rule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類st2common.persistence.trace.Trace
的用法示例。
在下文中一共展示了Trace.push_rule方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_update_via_list_push
# 需要導入模塊: from st2common.persistence.trace import Trace [as 別名]
# 或者: from st2common.persistence.trace.Trace import push_rule [as 別名]
def test_update_via_list_push(self):
no_action_executions = 4
no_rules = 4
no_trigger_instances = 5
saved = TraceDBTest._create_save_trace(
trace_tag='test_trace',
action_executions=[str(bson.ObjectId()) for _ in range(no_action_executions)],
rules=[str(bson.ObjectId()) for _ in range(no_rules)],
trigger_instances=[str(bson.ObjectId()) for _ in range(no_trigger_instances)])
# push updates
Trace.push_action_execution(
saved, action_execution=TraceComponentDB(object_id=str(bson.ObjectId())))
Trace.push_rule(saved, rule=TraceComponentDB(object_id=str(bson.ObjectId())))
Trace.push_trigger_instance(
saved, trigger_instance=TraceComponentDB(object_id=str(bson.ObjectId())))
retrieved = Trace.get(id=saved.id)
self.assertEquals(retrieved.id, saved.id, 'Incorrect trace retrieved.')
self.assertEquals(len(retrieved.action_executions), no_action_executions + 1)
self.assertEquals(len(retrieved.rules), no_rules + 1)
self.assertEquals(len(retrieved.trigger_instances), no_trigger_instances + 1)