本文整理汇总了Python中st2common.models.db.liveaction.LiveActionDB.runner方法的典型用法代码示例。如果您正苦于以下问题:Python LiveActionDB.runner方法的具体用法?Python LiveActionDB.runner怎么用?Python LiveActionDB.runner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.models.db.liveaction.LiveActionDB
的用法示例。
在下文中一共展示了LiveActionDB.runner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_liveaction_with_incorrect_output_schema
# 需要导入模块: from st2common.models.db.liveaction import LiveActionDB [as 别名]
# 或者: from st2common.models.db.liveaction.LiveActionDB import runner [as 别名]
def test_update_liveaction_with_incorrect_output_schema(self):
liveaction_db = LiveActionDB()
liveaction_db.status = 'initializing'
liveaction_db.start_timestamp = get_datetime_utc_now()
liveaction_db.action = ResourceReference(
name=ActionDBUtilsTestCase.action_db.name,
pack=ActionDBUtilsTestCase.action_db.pack).ref
params = {
'actionstr': 'foo',
'some_key_that_aint_exist_in_action_or_runner': 'bar',
'runnerint': 555
}
liveaction_db.parameters = params
runner = mock.MagicMock()
runner.output_schema = {
"notaparam": {
"type": "boolean"
}
}
liveaction_db.runner = runner
liveaction_db = LiveAction.add_or_update(liveaction_db)
origliveaction_db = copy.copy(liveaction_db)
now = get_datetime_utc_now()
status = 'succeeded'
result = 'Work is done.'
context = {'third_party_id': uuid.uuid4().hex}
newliveaction_db = action_db_utils.update_liveaction_status(
status=status, result=result, context=context, end_timestamp=now,
liveaction_id=liveaction_db.id)
self.assertEqual(origliveaction_db.id, newliveaction_db.id)
self.assertEqual(newliveaction_db.status, status)
self.assertEqual(newliveaction_db.result, result)
self.assertDictEqual(newliveaction_db.context, context)
self.assertEqual(newliveaction_db.end_timestamp, now)