def test_clone_template(self): """@Test: Assure ability to clone a provisioning template @Feature: Template - Clone @Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it @Assert: template is cloned """ name = gen_string("alpha", 6) clone_name = gen_string("alpha", 6) temp_type = 'provision' os_list = [ entities.OperatingSystem().create_json()['name'] for _ in range(2) ] template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.clone(name, custom_really=False, clone_name=clone_name, os_list=os_list) self.assertIsNotNone(self.template.search(clone_name))
def test_negative_create_with_same_name(self): """Template - Create a new template with same name :id: 52382553-2708-47d0-97b2-fce6ddb366ad :expectedresults: Template is not created :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone( self.template.wait_until_element( common_locators['name_haserror']))
def test_update_template_os(self): """@Test: Creates new template, along with two OS's and associate list of OS's with created template @Feature: Template - Positive Update @Assert: The template should be updated with newly created OS's successfully @BZ: 1129612 """ name = generate_string("alpha", 6) new_name = generate_string("alpha", 6) temp_type = 'provision' os_name1 = generate_string("alpha", 6) os_name2 = generate_string("alpha", 6) os_list = [os_name1, os_name2] major_version = generate_string('numeric', 1) template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: for os_name in os_list: make_os(session, name=os_name, major_version=major_version) self.assertIsNotNone(self.operatingsys.search(os_name)) make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_update_template_os(self): """@Test: Creates new template, along with two OS's and associate list of OS's with created template @Feature: Template - Positive Update @Assert: The template should be updated with newly created OS's successfully """ name = gen_string("alpha", 6) new_name = gen_string("alpha", 6) temp_type = 'provision' os_list = [ entities.OperatingSystem().create_json()['name'] for _ in range(2) ] template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_positive_clone(self): """Assure ability to clone a provisioning template :id: 912f1619-4bb0-4e0f-88ce-88b5726fdbe0 :Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it :expectedresults: The template is cloned :CaseLevel: Integration """ name = gen_string('alpha') clone_name = gen_string('alpha') os_list = [ entities.OperatingSystem().create().name for _ in range(2) ] with Session(self) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) self.template.clone( name, custom_really=False, clone_name=clone_name, os_list=os_list, ) self.assertIsNotNone(self.template.search(clone_name))
def test_add_configtemplate_1(self, template): """@test: Add config template by using organization name and configtemplate name. @feature: Organizations associate config template. @assert: configtemplate is added @BZ: 1129612 """ strategy, value = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) session.nav.go_to_provisioning_templates() make_templates(session, name=template, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(template)) self.org.update(org_name, new_templates=[template]) self.org.search(org_name).click() self.org.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element((strategy, value % template)) self.assertIsNotNone(element)
def test_update_template_os(self): """@Test: Creates new template, along with two OS's and associate list of OS's with created template @Feature: Template - Positive Update @Assert: The template should be updated with newly created OS's successfully @BZ: 1129612 """ name = gen_string("alpha", 6) new_name = gen_string("alpha", 6) temp_type = 'provision' os_1_name = entities.OperatingSystem().create()['name'] os_2_name = entities.OperatingSystem().create()['name'] os_list = [os_1_name, os_2_name] template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_positive_clone(self): """@Test: Assure ability to clone a provisioning template @Feature: Template - Clone @Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it @Assert: The template is cloned """ name = gen_string('alpha') clone_name = gen_string('alpha') os_list = [ entities.OperatingSystem().create().name for _ in range(2) ] with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) self.template.clone( name, custom_really=False, clone_name=clone_name, os_list=os_list, ) self.assertIsNotNone(self.template.search(clone_name))
def test_positive_clone(self): """Assure ability to clone a provisioning template @id: 912f1619-4bb0-4e0f-88ce-88b5726fdbe0 @Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it @Assert: The template is cloned @CaseLevel: Integration """ name = gen_string('alpha') clone_name = gen_string('alpha') os_list = [ entities.OperatingSystem().create().name for _ in range(2) ] with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) self.template.clone( name, custom_really=False, clone_name=clone_name, os_list=os_list, ) self.assertIsNotNone(self.template.search(clone_name))
def test_negative_create_template_with_same_name(self): """@Test: Template - Create a new template with same name @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string('alpha') with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.wait_until_element( common_locators['name_haserror']))
def test_update_template_os(self): """@Test: Creates new template, along with two OS's and associate list of OS's with created template @Feature: Template - Positive Update @Assert: The template should be updated with newly created OS's successfully """ name = gen_string('alpha') new_name = gen_string('alpha') os_list = [ entities.OperatingSystem().create().name for _ in range(2) ] with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_positive_advanced_search(self): """Create new provisioning template and associate it with specific organization and location. Also associate it with new hostgroup. Afterwards search for that template by hostgroup :id: 5bcecd40-28af-4913-92a4-863c8dc05ecc :BZ: 1386334 :expectedresults: Template can be found successfully and no error is raised :CaseImportance: Critical """ org = entities.Organization().create() loc = entities.Location().create() hostgroup = entities.HostGroup(organization=[org], location=[loc]).create() template_name = gen_string('alpha') with Session(self) as session: set_context(session, org=org.name, loc=loc.name) make_templates( session, name=template_name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', hostgroup=hostgroup.name, ) self.assertIsNotNone(self.template.search(template_name)) self.assertIsNotNone( self.template.search(template_name, _raw_query='hostgroup = {}'.format( hostgroup.name)))
def test_positive_update_os(self): """Creates new template, along with two OS's and associate list of OS's with created template :id: 160d7906-dd60-4870-8ca0-dde61ccab67c :expectedresults: The template should be updated with newly created OS's successfully :CaseImportance: Critical """ name = gen_string('alpha') new_name = gen_string('alpha') os_list = [entities.OperatingSystem().create().name for _ in range(2)] with Session(self) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_positive_add_template(self): """Add config template by using location name and config template name. @feature: Locations @assert: config template is added. """ strategy, value = common_locators['all_values_selection'] with Session(self.browser) as session: for template in generate_strings_list(): with self.subTest(template): loc_name = gen_string('alpha') make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) make_templates( session, name=template, template_path=get_data_file(OS_TEMPLATE_DATA_FILE), custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(template)) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_template']) element = session.nav.wait_until_element( (strategy, value % template)) self.assertIsNotNone(element)
def test_remove_configtemplate_1(self, template): """ @test: Remove config template. @feature: Organizations dissociate config templates. @assert: configtemplate is added then removed. @BZ: 1129612 """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=template, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(template)) make_org(session, org_name=org_name, templates=[template], edit=True) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element((strategy1, value1 % template)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, templates=[template]) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = self.org.wait_until_element((strategy, value % template)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertIsNotNone(element)
def test_remove_configtemplate_1(self, template): """@test: Remove config template @feature: Locations @assert: configtemplate is added then removed @BZ: 1096333 """ strategy, value = common_locators["all_values_selection"] loc_name = generate_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=template, template_path=template_path, template_type=temp_type, custom_really=True) self.assertIsNotNone(self.template.search(template)) make_loc(session, name=loc_name, edit=True) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element((strategy, value % template)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertIsNotNone(element) self.template.delete(template, True) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element((strategy, value % template)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertIsNone(element)
def test_positive_update_os(self): """Creates new template, along with two OS's and associate list of OS's with created template :id: 160d7906-dd60-4870-8ca0-dde61ccab67c :expectedresults: The template should be updated with newly created OS's successfully :CaseImportance: Critical """ name = gen_string('alpha') new_name = gen_string('alpha') os_list = [ entities.OperatingSystem().create().name for _ in range(2) ] with Session(self) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, new_os_list=os_list) self.assertIsNotNone(self.template.search(new_name))
def test_update_os_template(self): """ @Test: Update provisioning template @Feature: OS - Positive Update @Assert: OS is updated @BZ: 1129612 """ os_name = generate_string("alpha", 6) major_version = generate_string('numeric', 1) template_name = generate_string("alpha", 4) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) os_list = [os_name] with Session(self.browser) as session: make_os(session, name=os_name, major_version=major_version) self.assertIsNotNone(self.operatingsys.search(os_name)) make_templates(session, name=template_name, template_path=template_path, custom_really=True, template_type=temp_type, os_list=os_list) self.assertIsNotNone(self.template.search(template_name)) self.navigator.go_to_operating_systems() self.operatingsys.update(os_name, template=template_name) result_obj = self.operatingsys.get_os_entities(os_name, "template") self.assertEqual(template_name, result_obj['template'])
def test_positive_add_template(self): """Add config template by using location name and config template name. :id: 8faf60d1-f4d6-4a58-a484-606a42957ce7 :expectedresults: config template is added. :CaseLevel: Integration """ strategy, value = common_locators['all_values_selection'] with Session(self) as session: for template in generate_strings_list(): with self.subTest(template): loc_name = gen_string('alpha') make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) make_templates( session, name=template, template_path=get_data_file(OS_TEMPLATE_DATA_FILE), custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(template)) self.location.search_and_click(loc_name) session.nav.click(tab_locators['context.tab_template']) element = session.nav.wait_until_element( (strategy, value % template)) self.assertIsNotNone(element)
def test_positive_clone(self): """Assure ability to clone a provisioning template @Feature: Template - Clone @Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it @Assert: The template is cloned """ name = gen_string('alpha') clone_name = gen_string('alpha') os_list = [entities.OperatingSystem().create().name for _ in range(2)] with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) self.template.clone( name, custom_really=False, clone_name=clone_name, os_list=os_list, ) self.assertIsNotNone(self.template.search(clone_name))
def test_negative_create_with_same_name(self): """Template - Create a new template with same name @id: 52382553-2708-47d0-97b2-fce6ddb366ad @Assert: Template is not created """ name = gen_string('alpha') with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.wait_until_element( common_locators['name_haserror']))
def test_add_configtemplate_1(self, template): """@test: Add config template by using location name and configtemplate name. @feature: Locations @assert: configtemplate is added. """ strategy, value = common_locators["all_values_selection"] loc_name = gen_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) make_templates(session, name=template, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(template)) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element((strategy, value % template)) self.assertIsNotNone(element)
def test_negative_create_with_same_name(self): """Template - Create a new template with same name @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string('alpha') with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone( self.template.wait_until_element( common_locators['name_haserror']))
def test_positive_add_template(self): """Add config template by using location name and config template name. :id: 8faf60d1-f4d6-4a58-a484-606a42957ce7 :expectedresults: config template is added. :CaseLevel: Integration """ strategy, value = common_locators['all_values_selection'] with Session(self.browser) as session: for template in generate_strings_list(): with self.subTest(template): loc_name = gen_string('alpha') make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) make_templates( session, name=template, template_path=get_data_file(OS_TEMPLATE_DATA_FILE), custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(template)) self.location.search_and_click(loc_name) session.nav.click(tab_locators['context.tab_template']) element = session.nav.wait_until_element( (strategy, value % template)) self.assertIsNotNone(element)
def test_add_configtemplate_1(self, template): """@test: Add config template by using location name and configtemplate name. @feature: Locations @assert: configtemplate is added. """ strategy, value = common_locators["all_values_selection"] loc_name = gen_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) make_templates(session, name=template, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(template)) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element( (strategy, value % template)) self.assertIsNotNone(element)
def test_negative_create_template_4(self): """@Test: Template - Create a new template with same name @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone( self.template.wait_until_element( common_locators["name_haserror"]))
def test_clone_template(self): """@Test: Assure ability to clone a provisioning template @Feature: Template - Clone @Steps: 1. Go to Provisioning template UI 2. Choose a template and attempt to clone it @Assert: template is cloned """ name = gen_string("alpha", 6) clone_name = gen_string("alpha", 6) temp_type = 'provision' os_list = [ entities.OperatingSystem().create()['name'] for _ in range(2) ] template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.clone(name, custom_really=False, clone_name=clone_name, os_list=os_list) self.assertIsNotNone(self.template.search(clone_name))
def test_positive_create_snippet_template(self, name): """@Test: Create new template of type snippet @Feature: Template - Positive Create @Assert: New provisioning template of type 'snippet' should be created successfully """ template_path = get_data_file(SNIPPET_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, snippet=True) self.assertIsNotNone(self.template.search(name))
def test_negative_create_template_2(self, name): """@Test: Create a new template with blank and whitespace in name @Feature: Template - Negative Create @Assert: Template is not created """ temp_type = "provision" template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.wait_until_element(common_locators["name_haserror"]))
def test_negative_create_template_1(self): """@Test: Template - Create a new template with 256 characters in name @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 256) temp_type = "provision" template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.wait_until_element(common_locators["name_haserror"]))
def test_negative_create_template_5(self): """@Test: Template - Create a new template without selecting its type @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) temp_type = "" template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: with self.assertRaises(Exception) as context: make_templates( session, name=name, template_path=template_path, custom_really=True, template_type=temp_type ) self.assertEqual(context.exception.message, "Could not create template '%s'" " without type" % name)
def test_negative_create_template_6(self): """@Test: Template - Create a new template without uploading a template @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) temp_type = "PXELinux" template_path = "" with Session(self.browser) as session: with self.assertRaises(Exception) as context: make_templates( session, name=name, template_path=template_path, custom_really=True, template_type=temp_type ) self.assertEqual(context.exception.message, "Could not create blank template '%s'" % name)
def test_negative_create_with_too_long_audit(self): """Create a new template with 256 characters in audit comments @id: 62b06765-f9d5-4e69-967f-76f2649f83ff @Assert: Template is not created """ with Session(self.browser) as session: make_templates( session, name=gen_string('alpha', 16), template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, audit_comment=gen_string('alpha', 256), template_type='PXELinux template', ) self.assertIsNotNone(self.template.wait_until_element( common_locators['haserror']))
def test_update_template(self): """@Test: Update template name and template type @Feature: Template - Positive Update @Assert: The template name and type should be updated successfully """ name = gen_string("alpha", 6) new_name = gen_string("alpha", 6) temp_type = "provision" new_temp_type = "PXELinux" template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, None, new_temp_type) self.assertIsNotNone(self.template.search(new_name))
def test_positive_create_template(self, name): """@Test: Create new template @Feature: Template - Positive Create @Assert: New provisioning template of type 'provision' should be created successfully @BZ: 1129612 """ temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone(self.template.search(name))
def test_negative_create_with_too_long_audit(self): """Create a new template with 256 characters in audit comments @Feature: Template - Negative Create @Assert: Template is not created """ with Session(self.browser) as session: make_templates( session, name=gen_string('alpha', 16), template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, audit_comment=gen_string('alpha', 256), template_type='PXELinux', ) self.assertIsNotNone( self.template.wait_until_element(common_locators['haserror']))
def test_negative_create_template_with_too_long_name(self): """@Test: Template - Create a new template with 256 characters in name @Feature: Template - Negative Create @Assert: Template is not created """ with Session(self.browser) as session: make_templates( session, name=gen_string('alpha', 256), template_path=get_data_file(OS_TEMPLATE_DATA_FILE), custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.wait_until_element (common_locators['name_haserror']))
def test_negative_create_with_invalid_name(self): """@Test: Create a new template with invalid names @Feature: Template - Negative Create @Assert: Template is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.wait_until_element( common_locators['name_haserror']))
def test_positive_create_with_snippet_type(self): """Create new template of type snippet @Feature: Template - Positive Create @Assert: New provisioning template of type 'snippet' should be created successfully """ with Session(self.browser) as session: for name in generate_strings_list(length=8): with self.subTest(name): make_templates( session, name=name, template_path=SNIPPET_DATA_FILE, custom_really=True, snippet=True, ) self.assertIsNotNone(self.template.search(name))
def test_positive_create_with_name(self): """Create new template using different valid names @Feature: Template - Positive Create @Assert: New provisioning template of type 'provision' should be created successfully """ with Session(self.browser) as session: for name in generate_strings_list(length=8): with self.subTest(name): make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name))
def test_negative_create_with_invalid_name(self): """Create a new template with invalid names @id: cfbc8e10-96b3-425c-ac21-f995a8b038e8 @Assert: Template is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.wait_until_element( common_locators['name_haserror']))
def test_positive_create_with_name(self): """@Test: Create new template using different valid names @Feature: Template - Positive Create @Assert: New provisioning template of type 'provision' should be created successfully """ with Session(self.browser) as session: for name in generate_strings_list(length=8): with self.subTest(name): make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name))
def test_positive_create_with_snippet_type(self): """Create new template of type snippet @id: 56f62153-6dd2-4120-9f23-386442f643c4 @Assert: New provisioning template of type 'snippet' should be created successfully """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_templates( session, name=name, template_path=SNIPPET_DATA_FILE, custom_really=True, snippet=True, ) self.assertIsNotNone(self.template.search(name))
def test_negative_create_template_2(self, name): """@Test: Create a new template with blank and whitespace in name @Feature: Template - Negative Create @Assert: Template is not created """ temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertIsNotNone( self.template.wait_until_element( common_locators["name_haserror"]))
def test_positive_create_with_name(self): """Create new template using different valid names @id: 12767d13-2531-4a3c-9527-3191bc9a1149 @Assert: New template of type 'Provisioning template' should be created successfully """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name))
def test_positive_remove_template(self): """Remove config template :id: f510eb04-6bbb-4153-bda0-a183d070b9f2 :expectedresults: config template is added and then removed :CaseLevel: Integration """ strategy, value = common_locators['all_values_selection'] with Session(self.browser) as session: for template_name in generate_strings_list(length=8): with self.subTest(template_name): loc_name = gen_string('alpha') make_templates( session, name=template_name, template_path=get_data_file(OS_TEMPLATE_DATA_FILE), template_type='Provisioning template', custom_really=True, ) self.assertIsNotNone(self.template.search(template_name)) make_loc( session, name=loc_name, organizations=[self.org_.name], ) self.location.search_and_click(loc_name) session.nav.click(tab_locators['context.tab_template']) element = session.nav.wait_until_element( (strategy, value % template_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.template.delete(template_name, dropdown_present=True) self.location.search_and_click(loc_name) session.nav.click(tab_locators['context.tab_template']) element = session.nav.wait_until_element( (strategy, value % template_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNone(element)
def test_remove_configtemplate_1(self, testdata): """ @test: Remove config template @feature: Locations @assert: configtemplate is added then removed """ bug_id = testdata.pop('bugzilla', None) if bug_id is not None and bz_bug_is_open(bug_id): self.skipTest('Bugzilla bug {0} is open.'.format(bug_id)) template = testdata['user_name'] strategy, value = common_locators["all_values_selection"] loc_name = gen_string("alpha", 8) temp_type = 'provision' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=template, template_path=template_path, template_type=temp_type, custom_really=True) self.assertIsNotNone(self.template.search(template)) make_loc(session, name=loc_name) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element( (strategy, value % template)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertIsNotNone(element) self.template.delete(template, True) self.location.search(loc_name).click() session.nav.wait_until_element( tab_locators["context.tab_template"]).click() element = session.nav.wait_until_element( (strategy, value % template)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertIsNone(element)
def test_negative_create_without_upload(self): """Template - Create a new template without uploading a template @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string('alpha') with Session(self.browser) as session: with self.assertRaises(UIError) as context: make_templates( session, name=name, template_path='', custom_really=True, template_type='PXELinux', ) self.assertEqual( context.exception.message, 'Could not create blank template "{0}"'.format(name))
def test_negative_create_with_too_long_audit(self): """Create a new template with 256 characters in audit comments :id: 62b06765-f9d5-4e69-967f-76f2649f83ff :expectedresults: Template is not created :CaseImportance: Critical """ with Session(self) as session: make_templates( session, name=gen_string('alpha', 16), template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, audit_comment=gen_string('alpha', 256), template_type='PXELinux template', ) self.assertIsNotNone( self.template.wait_until_element(common_locators['haserror']))
def test_positive_update_name_and_type(self): """Update template name and template type @Feature: Template - Positive Update @Assert: The template name and type should be updated successfully """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='provision', ) self.assertIsNotNone(self.template.search(name)) self.template.update(name, False, new_name, None, 'PXELinux') self.assertIsNotNone(self.template.search(new_name))
def test_negative_create_template_6(self): """@Test: Template - Create a new template without uploading a template @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) temp_type = 'PXELinux' template_path = "" with Session(self.browser) as session: with self.assertRaises(Exception) as context: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertEqual(context.exception.message, "Could not create blank template '%s'" % name)
def test_negative_create_without_type(self): """Template - Create a new template without selecting its type @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string('alpha') with Session(self.browser) as session: with self.assertRaises(UIError) as context: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='', ) self.assertEqual( context.exception.message, 'Could not create template "{0}" without type'.format( name))
def test_negative_create_template_5(self): """@Test: Template - Create a new template without selecting its type @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) temp_type = "" template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: with self.assertRaises(Exception) as context: make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type) self.assertEqual( context.exception.message, "Could not create template '%s'" " without type" % name)
def test_negative_create_template_7(self): """@Test: Create a new template with 256 characters in audit comments @Feature: Template - Negative Create @Assert: Template is not created """ name = gen_string("alpha", 16) audit_comment = gen_string("alpha", 256) temp_type = 'PXELinux' template_path = get_data_file(OS_TEMPLATE_DATA_FILE) with Session(self.browser) as session: make_templates(session, name=name, template_path=template_path, custom_really=True, audit_comment=audit_comment, template_type=temp_type) self.assertIsNotNone( self.template.wait_until_element(common_locators["haserror"]))
def test_positive_update_name_and_type(self): """Update template name and template type @id: f1a7d44d-5ac8-47e1-9084-ce8f166dbde5 @Assert: The template name and type should be updated successfully """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_templates( session, name=name, template_path=OS_TEMPLATE_DATA_FILE, custom_really=True, template_type='Provisioning template', ) self.assertIsNotNone(self.template.search(name)) self.template.update( name, False, new_name, None, 'PXELinux template') self.assertIsNotNone(self.template.search(new_name))