本文整理汇总了Python中shove.Shove.process_order方法的典型用法代码示例。如果您正苦于以下问题:Python Shove.process_order方法的具体用法?Python Shove.process_order怎么用?Python Shove.process_order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shove.Shove
的用法示例。
在下文中一共展示了Shove.process_order方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_order_invalid
# 需要导入模块: from shove import Shove [as 别名]
# 或者: from shove.Shove import process_order [as 别名]
def test_process_order_invalid(self):
"""If parse_order returns None, do not execute the order."""
shove = Shove({}, Mock())
shove.parse_order = Mock(return_value=None)
shove.execute = Mock()
shove.process_order('{"project": "asdf"}')
ok_(not shove.execute.called)
ok_(not shove.adapter.send_log.called)
示例2: test_process_order_valid
# 需要导入模块: from shove import Shove [as 别名]
# 或者: from shove.Shove import process_order [as 别名]
def test_process_order_valid(self):
"""If parse_order returns a valid order, execute it and send logs back to Captain."""
shove = Shove({}, Mock())
order = Order(project="asdf", command="qwer", log_key=23, log_queue="zxcv")
shove.parse_order = Mock(return_value=order)
shove.execute = Mock(return_value=(0, "output"))
shove.process_order('{"project": "asdf"}')
shove.execute.assert_called_with(order)
shove.adapter.send_log.assert_called_with(
"zxcv", JSON({"version": "1.0", "log_key": 23, "return_code": 0, "output": "output"})
)
示例3: test_process_order_valid
# 需要导入模块: from shove import Shove [as 别名]
# 或者: from shove.Shove import process_order [as 别名]
def test_process_order_valid(self):
"""If parse_order returns a valid order, execute it and send logs back to Captain."""
shove = Shove({})
order = Order(project='asdf', command='qwer', log_key=23, log_queue='zxcv')
shove.parse_order = Mock(return_value=order)
shove.execute = Mock(return_value=(0, 'output'))
eq_(shove.process_order('{"project": "asdf"}'), ('zxcv', JSON({
'version': '1.0',
'log_key': 23,
'return_code': 0,
'output': 'output'
})))
shove.execute.assert_called_with(order)