本文整理汇总了Python中pulp.server.managers.consumer.agent.AgentManager.cancel_request方法的典型用法代码示例。如果您正苦于以下问题:Python AgentManager.cancel_request方法的具体用法?Python AgentManager.cancel_request怎么用?Python AgentManager.cancel_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.managers.consumer.agent.AgentManager
的用法示例。
在下文中一共展示了AgentManager.cancel_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cancel
# 需要导入模块: from pulp.server.managers.consumer.agent import AgentManager [as 别名]
# 或者: from pulp.server.managers.consumer.agent.AgentManager import cancel_request [as 别名]
def test_cancel(self, agent, context, mock_factory):
consumer = {'id': 'xyz'}
mock_consumer_manager = Mock()
mock_consumer_manager.get_consumer = Mock(return_value=consumer)
mock_factory.consumer_manager = Mock(return_value=mock_consumer_manager)
mock_context = Mock()
mock_context.uuid = 'test-uuid'
mock_context.url = 'http://broker.com'
context.return_value = mock_context
mock_agent = Mock()
agent.return_value = mock_agent
# test manager
task_id = '1234'
agent_manager = AgentManager()
consumer_id = 'abc'
agent_manager.cancel_request(consumer_id, task_id)
# validations
mock_agent.cancel.assert_called_with(mock_context, task_id)