def test_reorder_unsaved_elements(appliance, request): # Automate BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1238721 element_1_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Text Box", 'default_text_box': "Default text" } element_2_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Check Box", 'default_value': True, 'field_required': True } service_dialog = DialogCollection(appliance) sd = service_dialog.create( label='label_' + fauxfactory.gen_alphanumeric(), description="my dialog", submit=True, cancel=True, ) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") element = box.elements.create(element_data=[element_1_data]) request.addfinalizer(sd.delete_if_exists) element.reorder_elements(True, element_2_data, element_1_data)
def test_reorder_unsaved_elements(appliance, request): # Automate BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1238721 element_1_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Text Box", 'default_text_box': "Default text" } element_2_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Check Box", 'default_value': True, 'field_required': True } service_dialog = DialogCollection(appliance) sd = service_dialog.create(label='label_' + fauxfactory.gen_alphanumeric(), description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") element = box.elements.create(element_data=[element_1_data]) request.addfinalizer(sd.delete_if_exists) element.reorder_elements(True, element_2_data, element_1_data)
def create_dialog(appliance, element_data, label=None): service_dialog = DialogCollection(appliance) if label is None: label = 'label_' + fauxfactory.gen_alphanumeric() sd = service_dialog.create(label=label, description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) return sd
def some_dialogs(appliance, request): to_delete = [] request.addfinalizer(lambda: map(lambda obj: obj.delete(), to_delete)) for i in range(6): random_str = fauxfactory.gen_alphanumeric(16) element_data = dict(ele_label='ele_label_{}'.format(random_str), ele_name='ele_name_{}'.format(random_str), choose_type='Check Box') service_dialogs = DialogCollection(appliance) sd = service_dialogs.create(label='test_paginator_{}'.format(random_str), description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_{}'.format(random_str), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_{}'.format(random_str), box_desc="my box desc") box.elements.create(element_data=[element_data]) to_delete.append(sd) return to_delete
def dialog(): service_dialogs = DialogCollection() dialog = "dialog_{}".format(fauxfactory.gen_alphanumeric()) element_data = dict( ele_label="ele_{}".format(fauxfactory.gen_alphanumeric()), ele_name=fauxfactory.gen_alphanumeric(), ele_desc="my ele desc", choose_type="Text Box", default_text_box="default value" ) service_dialog = service_dialogs.create(label=dialog, description="my dialog", submit=True, cancel=True,) tab = service_dialog.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) return service_dialog
def dialog(appliance, copy_instance, create_method): service_dialogs = DialogCollection(appliance) dialog = "dialog_" + fauxfactory.gen_alphanumeric() element_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Drop Down List", 'dynamic_chkbox': True } sd = service_dialogs.create(label=dialog, description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) yield sd
def dialog(appliance): service_dialogs = DialogCollection(appliance) dialog = fauxfactory.gen_alphanumeric() element_data = dict( ele_label="ele_" + fauxfactory.gen_alphanumeric(), ele_name="service_name", ele_desc="my ele desc", choose_type="Text Box", default_text_box=dialog ) sd = service_dialogs.create(label=dialog, description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) yield sd
def tagcontrol_dialog(appliance): service_dialogs = DialogCollection(appliance) dialog = "dialog_" + fauxfactory.gen_alphanumeric() element_data = { 'ele_label': "Service Level", 'ele_name': "service_level", 'ele_desc': "service_level_desc", 'choose_type': "Tag Control", 'field_category': "Service Level", 'field_required': True } sd = service_dialogs.create(label=dialog, description="my dialog", submit=True, cancel=True,) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) yield sd
def dialog(appliance): service_dialogs = DialogCollection(appliance) dialog = fauxfactory.gen_alphanumeric() element_data = dict(ele_label="ele_" + fauxfactory.gen_alphanumeric(), ele_name="service_name", ele_desc="my ele desc", choose_type="Text Box", default_text_box=dialog) sd = service_dialogs.create( label=dialog, description="my dialog", submit=True, cancel=True, ) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) yield sd
def dialog(appliance, copy_instance, create_method): service_dialogs = DialogCollection(appliance) dialog = "dialog_" + fauxfactory.gen_alphanumeric() element_data = { 'ele_label': "ele_" + fauxfactory.gen_alphanumeric(), 'ele_name': fauxfactory.gen_alphanumeric(), 'ele_desc': fauxfactory.gen_alphanumeric(), 'choose_type': "Drop Down List", 'dynamic_chkbox': True } sd = service_dialogs.create( label=dialog, description="my dialog", submit=True, cancel=True, ) tab = sd.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) yield sd
def some_dialogs(appliance, request): to_delete = [] request.addfinalizer(lambda: map(lambda obj: obj.delete(), to_delete)) for i in range(6): random_str = fauxfactory.gen_alphanumeric(16) element_data = dict(ele_label='ele_label_{}'.format(random_str), ele_name='ele_name_{}'.format(random_str), choose_type='Check Box') service_dialogs = DialogCollection(appliance) sd = service_dialogs.create( label='test_paginator_{}'.format(random_str), description="my dialog", submit=True, cancel=True, ) tab = sd.tabs.create(tab_label='tab_{}'.format(random_str), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_{}'.format(random_str), box_desc="my box desc") box.elements.create(element_data=[element_data]) to_delete.append(sd) return to_delete
def dialog(): service_dialogs = DialogCollection() dialog = "dialog_{}".format(fauxfactory.gen_alphanumeric()) element_data = dict(ele_label="ele_{}".format( fauxfactory.gen_alphanumeric()), ele_name=fauxfactory.gen_alphanumeric(), ele_desc="my ele desc", choose_type="Text Box", default_text_box="default value") service_dialog = service_dialogs.create( label=dialog, description="my dialog", submit=True, cancel=True, ) tab = service_dialog.tabs.create(tab_label='tab_' + fauxfactory.gen_alphanumeric(), tab_desc="my tab desc") box = tab.boxes.create(box_label='box_' + fauxfactory.gen_alphanumeric(), box_desc="my box desc") box.elements.create(element_data=[element_data]) return service_dialog