本文整理匯總了Python中robottelo.cli.base.Base.create方法的典型用法代碼示例。如果您正苦於以下問題:Python Base.create方法的具體用法?Python Base.create怎麽用?Python Base.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類robottelo.cli.base.Base
的用法示例。
在下文中一共展示了Base.create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_add_create_with_empty_result
# 需要導入模塊: from robottelo.cli.base import Base [as 別名]
# 或者: from robottelo.cli.base.Base import create [as 別名]
def test_add_create_with_empty_result(self, construct, execute):
"""Check command create when result is empty"""
execute.return_value = []
self.assertEqual(
execute.return_value,
Base.create()
)
self.assertEqual('create', Base.command_sub)
construct.called_once_with({})
execute.called_once_with(construct.return_value, output_format='csv')
示例2: test_add_create_with_result_dct_without_id
# 需要導入模塊: from robottelo.cli.base import Base [as 別名]
# 或者: from robottelo.cli.base.Base import create [as 別名]
def test_add_create_with_result_dct_without_id(
self, construct, execute, info):
"""Check command create when result has dct but dct hasn't id key"""
execute.return_value = [{'not_id': 'foo'}]
self.assertEqual(
execute.return_value,
Base.create()
)
self.assertEqual('create', Base.command_sub)
construct.called_once_with({})
execute.called_once_with(construct.return_value, output_format='csv')
self.assertFalse(info.called)
示例3: test_add_create_with_result_dct_with_id_required_org
# 需要導入模塊: from robottelo.cli.base import Base [as 別名]
# 或者: from robottelo.cli.base.Base import create [as 別名]
def test_add_create_with_result_dct_with_id_required_org(
self, construct, execute, info):
"""Check command create when result has dct id key and organization
is required
"""
execute.return_value = [{'id': 'foo', 'bar': 'bas'}]
Base.command_requires_org = True
self.assertEqual(
execute.return_value,
Base.create({'organization-id': 'org-id'})
)
self.assertEqual('create', Base.command_sub)
construct.called_once_with({})
execute.called_once_with(construct.return_value, output_format='csv')
info.called_once_with({'id': 'foo', 'organization-id': 'org-id'})