本文整理汇总了Python中cfme.automate.buttons.ButtonGroup.delete_if_exists方法的典型用法代码示例。如果您正苦于以下问题:Python ButtonGroup.delete_if_exists方法的具体用法?Python ButtonGroup.delete_if_exists怎么用?Python ButtonGroup.delete_if_exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfme.automate.buttons.ButtonGroup
的用法示例。
在下文中一共展示了ButtonGroup.delete_if_exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testing_group
# 需要导入模块: from cfme.automate.buttons import ButtonGroup [as 别名]
# 或者: from cfme.automate.buttons.ButtonGroup import delete_if_exists [as 别名]
def testing_group(request):
group_desc = fauxfactory.gen_alphanumeric()
group = ButtonGroup(
text=group_desc,
hover=group_desc,
type=ButtonGroup.VM_INSTANCE
)
group.create()
yield group
group.delete_if_exists()
示例2: custom_service_button
# 需要导入模块: from cfme.automate.buttons import ButtonGroup [as 别名]
# 或者: from cfme.automate.buttons.ButtonGroup import delete_if_exists [as 别名]
def custom_service_button(ansible_catalog_item):
buttongroup = ButtonGroup(
text=fauxfactory.gen_alphanumeric(),
hover="btn_desc_{}".format(fauxfactory.gen_alphanumeric()))
buttongroup.type = buttongroup.SERVICE
buttongroup.create()
button = Button(
group=buttongroup,
text=fauxfactory.gen_alphanumeric(),
hover="btn_hvr_{}".format(fauxfactory.gen_alphanumeric()),
dialog=ansible_catalog_item.provisioning["provisioning_dialog_name"],
system="Request",
request="Order_Ansible_Playbook"
)
button.create()
yield button
button.delete_if_exists()
buttongroup.delete_if_exists()
示例3: custom_vm_button
# 需要导入模块: from cfme.automate.buttons import ButtonGroup [as 别名]
# 或者: from cfme.automate.buttons.ButtonGroup import delete_if_exists [as 别名]
def custom_vm_button(ansible_catalog_item):
buttongroup = ButtonGroup(
text=fauxfactory.gen_alphanumeric(),
hover="btn_desc_{}".format(fauxfactory.gen_alphanumeric()))
buttongroup.type = buttongroup.VM_INSTANCE
buttongroup.create()
button = Button(
group=buttongroup,
text=fauxfactory.gen_alphanumeric(),
hover="btn_hvr_{}".format(fauxfactory.gen_alphanumeric()),
dialog=ansible_catalog_item.provisioning["provisioning_dialog_name"],
system="Request",
request="Order_Ansible_Playbook",
attributes=[
{"key": "hosts", "value": "localhost"},
{"key": "service_template_name", "value": ansible_catalog_item.name}
]
)
button.create()
yield button
button.delete_if_exists()
buttongroup.delete_if_exists()
示例4: retire_extend_button
# 需要导入模块: from cfme.automate.buttons import ButtonGroup [as 别名]
# 或者: from cfme.automate.buttons.ButtonGroup import delete_if_exists [as 别名]
def retire_extend_button(request):
grp_name = "grp_{}".format(fauxfactory.gen_alphanumeric())
grp = ButtonGroup(
text=grp_name,
hover=grp_name,
type=ButtonGroup.VM_INSTANCE
)
request.addfinalizer(lambda: grp.delete_if_exists())
grp.create()
btn_name = "btn_{}".format(fauxfactory.gen_alphanumeric())
button = Button(
group=grp,
text=btn_name,
hover=btn_name,
system="Request",
request="vm_retire_extend"
)
request.addfinalizer(lambda: button.delete_if_exists())
button.create()
return lambda: toolbar.select(grp.text, button.text)
示例5: test_vm_retire_extend
# 需要导入模块: from cfme.automate.buttons import ButtonGroup [as 别名]
# 或者: from cfme.automate.buttons.ButtonGroup import delete_if_exists [as 别名]
def test_vm_retire_extend(appliance, request, testing_vm, soft_assert):
""" Tests extending a retirement using an AE method.
Prerequisities:
* A running VM on any provider.
Steps:
* It creates a button pointing to ``Request/vm_retire_extend`` instance. The button should
live in the VM and Instance button group.
* Then it sets a retirement date for the VM
* Then it waits until the retirement date is set
* Then it clicks the button that was created and it waits for the retirement date to extend.
Metadata:
test_flag: retire, provision
"""
num_days = 5
soft_assert(testing_vm.retirement_date == 'Never', "The retirement date is not 'Never'!")
retirement_date = generate_retirement_date(delta=num_days)
testing_vm.set_retirement_date(retirement_date)
wait_for(lambda: testing_vm.retirement_date != 'Never', message="retirement date set")
set_date = testing_vm.retirement_date
vm_retire_date_fmt = VM.RETIRE_DATE_FMT.pick(appliance.version)
if not BZ(1419150, forced_streams='5.6').blocks:
soft_assert(set_date == retirement_date.strftime(vm_retire_date_fmt),
"The retirement date '{}' did not match expected date '{}'"
.format(set_date, retirement_date.strftime(vm_retire_date_fmt)))
# Create the vm_retire_extend button and click on it
grp_name = "grp_{}".format(fauxfactory.gen_alphanumeric())
grp = ButtonGroup(
text=grp_name,
hover=grp_name,
type=ButtonGroup.VM_INSTANCE
)
request.addfinalizer(lambda: grp.delete_if_exists())
grp.create()
btn_name = "btn_{}".format(fauxfactory.gen_alphanumeric())
button = Button(
group=grp,
text=btn_name,
hover=btn_name,
system="Request",
request="vm_retire_extend"
)
request.addfinalizer(lambda: button.delete_if_exists())
button.create()
navigate_to(testing_vm, 'Details')
class TestDropdownView(InfraVmSummaryView):
group = Dropdown(grp.text)
view = appliance.browser.create_view(TestDropdownView)
view.group.item_select(button.text)
# CFME automate vm_retire_extend method defaults to extending the date by 14 days
extend_duration_days = 14
extended_retirement_date = retirement_date + timedelta(days=extend_duration_days)
# Check that the WebUI updates with the correct date
wait_for(
lambda: testing_vm.retirement_date >= extended_retirement_date.strftime(vm_retire_date_fmt),
num_sec=60,
message="Check for extension of the VM retirement date by {} days".format(
extend_duration_days)
)