當前位置: 首頁>>代碼示例>>Python>>正文


Python Base.execute方法代碼示例

本文整理匯總了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)
開發者ID:BlackSmith,項目名稱:robottelo,代碼行數:17,代碼來源:test_cli.py

示例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)
開發者ID:BlackSmith,項目名稱:robottelo,代碼行數:24,代碼來源:test_cli.py


注:本文中的robottelo.cli.base.Base.execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。