本文整理汇总了Python中marvin.lib.base.Template.update方法的典型用法代码示例。如果您正苦于以下问题:Python Template.update方法的具体用法?Python Template.update怎么用?Python Template.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Template
的用法示例。
在下文中一共展示了Template.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_03_edit_template_details
# 需要导入模块: from marvin.lib.base import Template [as 别名]
# 或者: from marvin.lib.base.Template import update [as 别名]
def test_03_edit_template_details(self):
"""
@Desc: Test to Edit Template name, displaytext, OSType
@steps:
Step1: Listing all the Templates for a user
Step2: Verifying that no Templates are listed
Step3: Creating a Templates
Step4: Listing all the Templates again for a user
Step5: Verifying that list size is 1
Step6: Verifying if the template is in ready state.
If yes the continuing
If not waiting and checking for template to be ready till timeout
Step7: Editing the template name
Step8: Verifying that Template name is edited
Step9: Editing the template displaytext
Step10: Verifying that Template displaytext is edited
Step11: Editing the template ostypeid
Step12: Verifying that Template ostypeid is edited
Step13: Editing the template name, displaytext
Step14: Verifying that Template name, displaytext are edited
Step15: Editing the template name, displaytext, ostypeid
Step16: Verifying that Template name, displaytext and ostypeid are edited
"""
# Listing all the Templates for a User
list_templates_before = Template.list(
self.userapiclient,
listall=self.services["listall"],
templatefilter=self.services["templatefilter"]
)
# Verifying that no Templates are listed
self.assertIsNone(
list_templates_before,
"Templates listed for newly created User"
)
self.services["privatetemplate"]["ostype"] = self.services["ostype"]
# Creating aTemplate
template_created = Template.register(
self.userapiclient,
self.services["privatetemplate"],
self.zone.id,
hypervisor=self.hypervisor
)
self.assertIsNotNone(
template_created,
"Template creation failed"
)
# Listing all the Templates for a User
list_templates_after = Template.list(
self.userapiclient,
listall=self.services["listall"],
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
self.assertEquals(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is 1
self.assertEquals(
1,
len(list_templates_after),
"Failed to create a Template"
)
# Verifying the state of the template to be ready. If not waiting for
# state to become ready till time out
template_ready = False
count = 0
while template_ready is False:
list_template = Template.list(
self.userapiclient,
id=template_created.id,
listall=self.services["listall"],
templatefilter=self.services["templatefilter"],
)
status = validateList(list_template)
self.assertEquals(
PASS,
status[0],
"Failed to list Templates by Id"
)
if list_template[0].isready is True:
template_ready = True
elif (str(list_template[0].status) == "Error"):
self.fail("Created Template is in Errored state")
break
elif count > 10:
self.fail("Timed out before Template came into ready state")
break
else:
time.sleep(self.services["sleep"])
count = count + 1
# Editing the Template name
edited_template = Template.update(
template_created,
self.userapiclient,
name="NewTemplateName"
)
self.assertIsNotNone(
#.........这里部分代码省略.........