本文整理匯總了Python中robottelo.cli.base.Base.execute方法的典型用法代碼示例。如果您正苦於以下問題:Python Base.execute方法的具體用法?Python Base.execute怎麽用?Python Base.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類robottelo.cli.base.Base
的用法示例。
在下文中一共展示了Base.execute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_execute_with_raw_response
# 需要導入模塊: from robottelo.cli.base import Base [as 別名]
# 或者: from robottelo.cli.base.Base import execute [as 別名]
def test_execute_with_raw_response(self, settings, command):
"""Check excuted build ssh method and returns raw response"""
settings.locale = 'en_US'
settings.performance = False
settings.server.admin_username = 'admin'
settings.server.admin_password = 'password'
response = Base.execute('some_cmd', return_raw_response=True)
ssh_cmd = u'LANG=en_US hammer -v -u admin -p password some_cmd'
command.assert_called_once_with(
ssh_cmd.encode('utf-8'),
output_format=None,
timeout=None,
connection_timeout=None
)
self.assertIs(response, command.return_value)
示例2: test_execute_with_performance
# 需要導入模塊: from robottelo.cli.base import Base [as 別名]
# 或者: from robottelo.cli.base.Base import execute [as 別名]
def test_execute_with_performance(self, settings, command, handle_resp):
"""Check excuted build ssh method and delegate response handling"""
settings.locale = 'en_US'
settings.performance.timer_hammer = True
settings.server.admin_username = 'admin'
settings.server.admin_password = 'password'
response = Base.execute('some_cmd', output_format='json')
ssh_cmd = (
u'LANG=en_US time -p hammer -v -u admin -p password --output=json'
u' some_cmd'
)
command.assert_called_once_with(
ssh_cmd.encode('utf-8'),
output_format='json',
timeout=None,
connection_timeout=None
)
handle_resp.assert_called_once_with(
command.return_value,
ignore_stderr=None
)
self.assertIs(response, handle_resp.return_value)