本文整理汇总了Python中st2common.persistence.liveaction.LiveAction.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python LiveAction.get_all方法的具体用法?Python LiveAction.get_all怎么用?Python LiveAction.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.liveaction.LiveAction
的用法示例。
在下文中一共展示了LiveAction.get_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_liveaction_gets_deleted
# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import get_all [as 别名]
def test_liveaction_gets_deleted(self):
now = date_utils.get_datetime_utc_now()
start_ts = now - timedelta(days=15)
end_ts = now - timedelta(days=14)
liveaction_model = copy.deepcopy(self.models['liveactions']['liveaction4.yaml'])
liveaction_model['start_timestamp'] = start_ts
liveaction_model['end_timestamp'] = end_ts
liveaction_model['status'] = action_constants.LIVEACTION_STATUS_SUCCEEDED
liveaction = LiveAction.add_or_update(liveaction_model)
# Write one execution before cut-off threshold
exec_model = copy.deepcopy(self.models['executions']['execution1.yaml'])
exec_model['start_timestamp'] = start_ts
exec_model['end_timestamp'] = end_ts
exec_model['status'] = action_constants.LIVEACTION_STATUS_SUCCEEDED
exec_model['id'] = bson.ObjectId()
exec_model['liveaction']['id'] = str(liveaction.id)
ActionExecution.add_or_update(exec_model)
liveactions = LiveAction.get_all()
executions = ActionExecution.get_all()
self.assertEqual(len(liveactions), 1)
self.assertEqual(len(executions), 1)
purge_executions(logger=LOG, timestamp=now - timedelta(days=10))
liveactions = LiveAction.get_all()
executions = ActionExecution.get_all()
self.assertEqual(len(executions), 0)
self.assertEqual(len(liveactions), 0)
示例2: test_invalid_trace_id_provided
# 需要导入模块: from st2common.persistence.liveaction import LiveAction [as 别名]
# 或者: from st2common.persistence.liveaction.LiveAction import get_all [as 别名]
def test_invalid_trace_id_provided(self):
liveactions = LiveAction.get_all()
self.assertEqual(len(liveactions), 1) # fixtures loads it.
self.traceable_liveaction['context']['trace_context'] = {'id_': 'balleilaka'}
self.assertRaises(TraceNotFoundException, action_services.request,
self.traceable_liveaction)
# Make sure no liveactions are left behind
liveactions = LiveAction.get_all()
self.assertEqual(len(liveactions), 0)