def test_syncnow_custom_repos_yum(self): """@Test: Create Custom yum repos and sync it via the repos page. @Feature: Custom yum Repos - Sync via repos page @Assert: Whether Sync is successful """ product = entities.Product(organization=self.organization).create() with Session(self.browser) as session: for repo_name in generate_strings_list(): with self.subTest(repo_name): # Creates new repository using api entities.Repository( name=repo_name, url=FAKE_1_YUM_REPO, product=product, ).create() self.setup_navigate_syncnow( session, product.name, repo_name, ) # prd_sync_is_ok returns boolean values and not objects self.assertTrue(self.prd_sync_is_ok(repo_name))
def test_positive_update_product(self): """Update Sync plan and associate products @Feature: Content Sync Plan - Positive Update add products @Assert: Sync Plan has the associated product """ strategy, value = locators['sp.prd_select'] product = entities.Product(organization=self.organization).create() with Session(self.browser) as session: for plan_name in generate_strings_list(): with self.subTest(plan_name): entities.SyncPlan( name=plan_name, interval=SYNC_INTERVAL['week'], organization=self.organization, ).create() session.nav.go_to_select_org(self.organization.name) session.nav.go_to_sync_plans() self.syncplan.update( plan_name, add_products=[product.name]) self.syncplan.search(plan_name).click() # Assert product is associated with sync plan self.syncplan.click(tab_locators['sp.tab_products']) element = self.syncplan.wait_until_element( (strategy, value % product.name)) self.assertIsNotNone(element)
def test_add_compresource(self): """Add compute resource using the location name and compute resource name @feature: Locations @assert: compute resource is added successfully """ strategy, value = common_locators['entity_deselect'] with Session(self.browser) as session: for resource_name in generate_strings_list(): with self.subTest(resource_name): loc_name = gen_string('alpha') url = LIBVIRT_RESOURCE_URL % settings.server.hostname resource = entities.LibvirtComputeResource( name=resource_name, url=url).create() self.assertEqual(resource.name, resource_name) make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) self.location.update( loc_name, new_resources=[resource_name]) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_resources']) element = session.nav.wait_until_element( (strategy, value % resource_name)) self.assertIsNotNone(element)
def test_return_type(self): """This test validates return types for functions: 1. :meth:`robottelo.datafactory.generate_strings_list` 2. :meth:`robottelo.datafactory.invalid_emails_list` 3. :meth:`robottelo.datafactory.invalid_names_list` 4. :meth:`robottelo.datafactory.valid_data_list` 5. :meth:`robottelo.datafactory.valid_emails_list` 6. :meth:`robottelo.datafactory.valid_environments_list` 7. :meth:`robottelo.datafactory.valid_labels_list` 8. :meth:`robottelo.datafactory.valid_names_list` 9. :meth:`robottelo.datafactory.valid_usernames_list` 10. :meth:`robottelo.datafactory.invalid_id_list` """ for item in itertools.chain( generate_strings_list(), invalid_emails_list(), invalid_names_list(), valid_data_list(), valid_emails_list(), valid_environments_list(), valid_labels_list(), valid_names_list(), valid_usernames_list(),): self.assertIsInstance(item, six.text_type) for item in invalid_id_list(): if not (isinstance(item, (six.text_type, int)) or item is None): self.fail('Unexpected data type')
def test_positive_add_medium(self): """Add medium by using the location name and medium name @feature: Locations @assert: medium is added """ strategy, value = common_locators['entity_deselect'] with Session(self.browser) as session: for medium_name in generate_strings_list(): with self.subTest(medium_name): loc_name = gen_string('alpha') medium = entities.Media( name=medium_name, path_=INSTALL_MEDIUM_URL % gen_string('alpha', 6), os_family='Redhat', ).create() self.assertEqual(medium.name, medium_name) make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) self.location.update(loc_name, new_medias=[medium_name]) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_media']) element = session.nav.wait_until_element( (strategy, value % medium_name)) self.assertIsNotNone(element)
def test_positive_update_domain(self): """Add a domain to an organization and remove it by organization name and domain name. :id: a49e86c7-f859-4120-b59e-3f89e99a9054 :expectedresults: the domain is added and removed from the organization :CaseLevel: Integration """ with Session(self) as session: org_name = gen_string('alpha') make_org(session, org_name=org_name) for domain_name in generate_strings_list(): with self.subTest(domain_name): domain = entities.Domain(name=domain_name).create() self.assertEqual(domain.name, domain_name) kwargs = { 'org_name': org_name, 'entity_type': 'domains', 'entity_name': domain_name } self.assertIsNotNone(self.org.add_entity(**kwargs)) self.assertIsNotNone(self.org.remove_entity(**kwargs))
def test_positive_create_with_parameter_and_valid_separator(self): """Subnet parameters can be created with name with valid separators :id: d1e2d75a-a1e8-4767-93f1-0bb1b75e10a0 :steps: 1. Create Subnet with all the details 2. Create subnet parameter having key with name separated by valid separators(e.g fwd slash) and value :expectedresults: The parameter with name separated by valid separators should be saved in subnet """ subnet = entities.Subnet().create() valid_separators = [',', '/', '-', '|'] valid_names = [] for separator in valid_separators: valid_names.append( '{}'.format(separator).join(generate_strings_list()) ) value = gen_string('utf8') for name in valid_names: with self.subTest(name): subnet_param = entities.Parameter( name=name, subnet=subnet.id, value=value ).create() self.assertEqual(subnet_param.name, name) self.assertEqual(subnet_param.value, value)
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_positive_add_parameter_with_values_and_separator(self): """Subnet parameters can be created with values separated by comma :id: b3de6f96-7c39-4c44-b91c-a6d141f5dd6a :steps: 1. Create Subnet with all the details 2. Create subnet parameter having single key and values separated with comma :expectedresults: The parameter with values separated by comma should be saved in subnet """ subnet = entities.Subnet().create() name = gen_string('alpha') values = ', '.join(generate_strings_list()) with self.subTest(name): subnet_param = entities.Parameter( name=name, subnet=subnet.id, value=values ).create() self.assertEqual(subnet_param.name, name) self.assertEqual(subnet_param.value, values)
def test_positive_update_url(self): """Update content repository with new URL @Feature: Content Repo - Positive Update @Assert: Repository is updated with expected url value """ product = entities.Product(organization=self.organization).create() with Session(self.browser) as session: for repo_name in generate_strings_list(): with self.subTest(repo_name): set_context(session, org=self.organization.name) self.products.search(product.name).click() make_repository( session, name=repo_name, url=FAKE_1_YUM_REPO, ) self.assertIsNotNone(self.repository.search(repo_name)) self.assertTrue(self.repository.validate_field( repo_name, 'url', FAKE_1_YUM_REPO)) self.products.search(product.name).click() self.repository.update(repo_name, new_url=FAKE_2_YUM_REPO) self.products.search(product.name).click() self.assertTrue(self.repository.validate_field( repo_name, 'url', FAKE_2_YUM_REPO))
def test_positive_sync_custom_repo_puppet(self): """Create Custom puppet repos and sync it via the repos page. @Feature: Custom puppet Repos - Sync via repos page @Assert: Sync procedure for specific puppet repository is successful """ # Creates new product product = entities.Product(organization=self.organization).create() with Session(self.browser) as session: for repo_name in generate_strings_list(): with self.subTest(repo_name): # Creates new puppet repository entities.Repository( name=repo_name, url=FAKE_0_PUPPET_REPO, product=product, content_type=REPO_TYPE['puppet'], ).create() self.setup_navigate_syncnow( session, product.name, repo_name, ) # prd_sync_is_ok returns boolean values and not objects self.assertTrue(self.prd_sync_is_ok(repo_name))
def test_positive_remove_hostgroup(self): """Add a hostgroup and remove it by using the organization name and hostgroup name. @feature: Organizations Remove Hostgroup. @assert: hostgroup is added to organization then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for host_grp_name in generate_strings_list(): with self.subTest(host_grp_name): org_name = gen_string("alpha") # Create hostgroup using nailgun host_grp = entities.HostGroup(name=host_grp_name).create() self.assertEqual(host_grp.name, host_grp_name) make_org(session, org_name=org_name, hostgroups=[host_grp_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_hostgrps"]) element = session.nav.wait_until_element((strategy1, value1 % host_grp_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, hostgroups=[host_grp_name], new_hostgroups=None) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_hostgrps"]) element = session.nav.wait_until_element((strategy, value % host_grp_name)) # Item is listed in 'All Items' list and not # Selected Items' list. self.assertIsNotNone(element)
def test_positive_create_in_different_orgs(self): """Create repository in two different orgs with same name @Feature: Content Repos - Positive Create @Assert: Repository is created successfully for both organizations """ org_2 = entities.Organization(name=gen_string('alpha')).create() product_1 = entities.Product(organization=self.organization).create() product_2 = entities.Product(organization=org_2).create() with Session(self.browser) as session: for repo_name in generate_strings_list(): with self.subTest(repo_name): set_context(session, org=self.organization.name) self.products.search(product_1.name).click() make_repository( session, name=repo_name, url=FAKE_1_YUM_REPO, ) self.assertIsNotNone(self.repository.search(repo_name)) set_context(session, org=org_2.name) self.products.search(product_2.name).click() make_repository( session, name=repo_name, url=FAKE_1_YUM_REPO, force_context=True, ) self.assertIsNotNone(self.repository.search(repo_name))
def test_positive_delete_withad(self): """Delete LDAP authentication with AD :id: 0fbb09d3-7a19-468d-898c-1484a5682793 :steps: 1. Create a new LDAP Auth source with AD. 2. Delete LDAP Auth source with AD. :expectedresults: Whether deleting LDAP Auth with AD is successful. :CaseImportance: Critical """ with Session(self) as session: for server_name in generate_strings_list(): with self.subTest(server_name): make_ldapauth( session, name=server_name, server=self.ldap_hostname, server_type=LDAP_SERVER_TYPE['UI']['ad'], login_name=LDAP_ATTR['login_ad'], first_name=LDAP_ATTR['firstname'], surname=LDAP_ATTR['surname'], mail=LDAP_ATTR['mail'], account_user=self.ldap_user_name, account_passwd=self.ldap_user_passwd, account_basedn=self.base_dn, account_grpbasedn=self.group_base_dn, ) self.assertIsNotNone( self.ldapauthsource.search(server_name) ) self.ldapauthsource.delete(server_name)
def test_positive_remove_compresource(self): """Remove compute resource using the organization name and compute resource name. @feature: Organizations dis-associate compute-resource. @assert: compute resource is added then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for resource_name in generate_strings_list(): with self.subTest(resource_name): org_name = gen_string("alpha") url = LIBVIRT_RESOURCE_URL % settings.server.hostname # Create compute resource using nailgun resource = entities.LibvirtComputeResource(name=resource_name, url=url).create() self.assertEqual(resource.name, resource_name) make_org(session, org_name=org_name, resources=[resource_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_resources"]) element = session.nav.wait_until_element((strategy1, value1 % resource_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, resources=[resource_name], new_resources=None) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_resources"]) element = session.nav.wait_until_element((strategy, value % resource_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_remove_medium(self): """Remove medium by using organization name and medium name. @feature: Organizations disassociate installation media. @assert: medium is added then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for medium_name in generate_strings_list(): with self.subTest(medium_name): org_name = gen_string("alpha") # Create media using nailgun medium = entities.Media( name=medium_name, path_=INSTALL_MEDIUM_URL % gen_string("alpha", 6), os_family="Redhat" ).create() self.assertEqual(medium.name, medium_name) make_org(session, org_name=org_name, medias=[medium_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_media"]) element = session.nav.wait_until_element((strategy1, value1 % medium_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.navigator.go_to_org() self.org.update(org_name, medias=[medium_name], new_medias=None) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_media"]) element = session.nav.wait_until_element((strategy, value % medium_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_create_withad(self): """Create LDAP authentication with AD :id: 02693108-83d9-4b2b-969e-2d8a00d0a935 :steps: 1. Create a new LDAP Auth source with AD. 2. Fill in all the fields appropriately for AD. :expectedresults: Whether creating LDAP Auth with AD is successful. :CaseImportance: Critical """ with Session(self) as session: for server_name in generate_strings_list(): with self.subTest(server_name): make_ldapauth( session, name=server_name, server=self.ldap_hostname, server_type=LDAP_SERVER_TYPE['UI']['ad'], login_name=LDAP_ATTR['login_ad'], first_name=LDAP_ATTR['firstname'], surname=LDAP_ATTR['surname'], mail=LDAP_ATTR['mail'], account_user=self.ldap_user_name, account_passwd=self.ldap_user_passwd, account_basedn=self.base_dn, account_grpbasedn=self.group_base_dn, ) self.assertIsNotNone( self.ldapauthsource.search(server_name) )
def test_positive_update_media(self): """Add/Remove medium from/to organization. :id: bcf3aaf4-cad9-4a22-a087-60b213eb87cf :expectedresults: medium is added then removed. :CaseLevel: Integration """ with Session(self) as session: org_name = gen_string('alpha') make_org(session, org_name=org_name) for media_name in generate_strings_list(): with self.subTest(media_name): # Create media using nailgun media = entities.Media( name=media_name, path_=INSTALL_MEDIUM_URL % gen_string('alpha', 6), os_family='Redhat', ).create() self.assertEqual(media.name, media_name) kwargs = { 'org_name': org_name, 'entity_type': 'medias', 'entity_name': media_name } self.assertIsNotNone(self.org.add_entity(**kwargs)) self.assertIsNotNone(self.org.remove_entity(**kwargs))
def test_positive_update(self): """Update partition table with its name, layout and OS family :id: 63203508-7c73-4ce0-853e-64564167bec3 :customerscenario: true :expectedresults: Partition table is updated :CaseImportance: Critical """ name = gen_string('alphanumeric') with Session(self) as session: make_partitiontable( session, name=name, template_path=PARTITION_SCRIPT_DATA_FILE, os_family='Debian', ) self.assertIsNotNone(self.partitiontable.search(name)) for new_name in generate_strings_list(): with self.subTest(new_name): self.partitiontable.update( old_name=name, new_name=new_name, new_template_path=PARTITION_SCRIPT_DATA_FILE, new_os_family='Red Hat', ) self.assertIsNotNone(self.partitiontable.search(new_name)) name = new_name # for next iteration
def test_positive_sync_custom_repo(self): """Create Content Custom Sync with minimal input parameters @Feature: Content Custom Sync - Positive Create @Assert: Sync procedure is successful """ # Creates new product product = entities.Product(organization=self.organization).create() with Session(self.browser) as session: for repository_name in generate_strings_list(): with self.subTest(repository_name): # Creates new repository through API entities.Repository( name=repository_name, url=FAKE_1_YUM_REPO, product=product, ).create() session.nav.go_to_select_org(self.organization.name) session.nav.go_to_sync_status() sync = self.sync.sync_custom_repos( product.name, [repository_name] ) # sync.sync_custom_repos returns boolean value self.assertTrue(sync)
def test_positive_update_compresource(self): """Remove compute resource using the organization name and compute resource name. :id: db119bb1-8f79-415b-a056-70a19ffceeea :expectedresults: compute resource is added then removed. :CaseLevel: Integration """ with Session(self) as session: org_name = gen_string('alpha') make_org(session, org_name=org_name) for resource_name in generate_strings_list(): with self.subTest(resource_name): url = (LIBVIRT_RESOURCE_URL % settings.compute_resources.libvirt_hostname) # Create compute resource using nailgun resource = entities.LibvirtComputeResource( name=resource_name, url=url ).create() self.assertEqual(resource.name, resource_name) kwargs = { 'org_name': org_name, 'entity_type': 'resources', 'entity_name': resource_name } self.assertIsNotNone(self.org.add_entity(**kwargs)) self.assertIsNotNone(self.org.remove_entity(**kwargs))
def test_positive_remove_template(self): """Remove config template. @feature: Organizations dissociate config templates. @assert: Config Template is added and then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for template_name in generate_strings_list(): with self.subTest(template_name): org_name = gen_string("alpha") # Create config template using nailgun entities.ConfigTemplate(name=template_name).create() make_org(session, org_name=org_name, templates=[template_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_template"]) element = session.nav.wait_until_element((strategy1, value1 % template_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, templates=[template_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_template"]) element = self.org.wait_until_element((strategy, value % template_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_update_hostgroup(self): """Add a hostgroup and remove it by using the organization name and hostgroup name. :id: 12e2fc40-d721-4e71-af7c-3db67b9e718e :expectedresults: hostgroup is added to organization then removed. :CaseLevel: Integration """ with Session(self) as session: org_name = gen_string('alpha') make_org(session, org_name=org_name) for hostgroup_name in generate_strings_list(): with self.subTest(hostgroup_name): # Create hostgroup using nailgun hostgroup = entities.HostGroup( name=hostgroup_name).create() self.assertEqual(hostgroup.name, hostgroup_name) kwargs = { 'org_name': org_name, 'entity_type': 'hostgroups', 'entity_name': hostgroup_name, } self.assertIsNotNone(self.org.add_entity(**kwargs)) self.assertIsNotNone(self.org.remove_entity(**kwargs))
def test_positive_remove_domain(self): """Add a domain to an location and remove it by location name and domain name @feature: Locations @assert: the domain is removed from the location """ strategy, value = common_locators['entity_select'] strategy1, value1 = common_locators['entity_deselect'] with Session(self.browser) as session: for domain_name in generate_strings_list(): with self.subTest(domain_name): loc_name = gen_string('alpha') domain = entities.Domain(name=domain_name).create() self.assertEqual(domain.name, domain_name) set_context(session, org=ANY_CONTEXT['org']) make_loc(session, name=loc_name, domains=[domain_name]) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_domains']) element = session.nav.wait_until_element( (strategy1, value1 % domain_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.location.update(loc_name, domains=[domain_name]) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_domains']) element = session.nav.wait_until_element( (strategy, value % domain_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_remove_hostgroup(self): """Add a hostgroup and remove it by using the location name and hostgroup name @feature: Locations @assert: hostgroup is added to location then removed """ strategy, value = common_locators['all_values_selection'] with Session(self.browser) as session: for host_grp_name in generate_strings_list(): with self.subTest(host_grp_name): loc_name = gen_string('alpha') host_grp = entities.HostGroup(name=host_grp_name).create() self.assertEqual(host_grp.name, host_grp_name) set_context(session, org=ANY_CONTEXT['org']) make_loc(session, name=loc_name) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_hostgrps']) element = session.nav.wait_until_element( (strategy, value % host_grp_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.hostgroup.delete(host_grp_name) self.location.search(loc_name).click() session.nav.click(tab_locators['context.tab_hostgrps']) element = session.nav.wait_until_element( (strategy, value % host_grp_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNone(element)
def test_positive_update_template(self): """Add and Remove config template. :id: 67bec745-5f10-494c-92a7-173ee63e8297 :expectedresults: Config Template is added and then removed. :CaseLevel: Integration """ with Session(self) as session: org_name = gen_string('alpha') make_org(session, org_name=org_name) for template_name in generate_strings_list(): with self.subTest(template_name): # Create config template using nailgun template = entities.ProvisioningTemplate( name=template_name).create() self.assertEqual(template.name, template_name) kwargs = { 'org_name': org_name, 'entity_type': 'templates', 'entity_name': template_name } self.assertIsNotNone(self.org.add_entity(**kwargs)) self.assertIsNotNone(self.org.remove_entity(**kwargs))
def test_positive_remove_domain(self): """Add a domain to an organization and remove it by organization name and domain name. @feature: Organizations Disassociate domain. @assert: the domain is removed from the organization """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for domain_name in generate_strings_list(): with self.subTest(domain_name): org_name = gen_string("alpha") domain = entities.Domain(name=domain_name).create() self.assertEqual(domain.name, domain_name) make_org(session, org_name=org_name, domains=[domain_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_domains"]) element = session.nav.wait_until_element((strategy1, value1 % domain_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, domains=[domain_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_domains"]) element = session.nav.wait_until_element((strategy, value % domain_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_remove_subnet(self): """Remove subnet by using organization name and subnet name. @feature: Organizations dis-associate subnet. @assert: subnet is added then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] with Session(self.browser) as session: for subnet_name in generate_strings_list(): with self.subTest(subnet_name): org_name = gen_string("alpha") # Create subnet using nailgun subnet = entities.Subnet( name=subnet_name, network=gen_ipaddr(ip3=True), mask="255.255.255.0" ).create() self.assertEqual(subnet.name, subnet_name) make_org(session, org_name=org_name, subnets=[subnet_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_subnets"]) element = session.nav.wait_until_element((strategy1, value1 % subnet_name)) # Item is listed in 'Selected Items' list and not # 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, subnets=[subnet_name]) self.org.search(org_name).click() session.nav.click(tab_locators["context.tab_subnets"]) element = session.nav.wait_until_element((strategy, value % subnet_name)) # Item is listed in 'All Items' list and not # 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_create_simple_job_template(self): """Create a simple Job Template :id: 7cb1e5b0-5420-47c5-bb43-e2c58bed7a9d :Steps: 1. Navigate to Hosts -> Job Templates 2. Enter a valid name 3. Populate the template code 4. Navigate to the job tab 5. Enter a job name 6. Click submit :expectedresults: The job template was successfully created :CaseImportance: Critical """ with Session(self) as session: for name in generate_strings_list(): with self.subTest(name): make_job_template( session, name=name, template_type='input', template_content=gen_string('alphanumeric', 500), ) self.assertIsNotNone(self.jobtemplate.search(name))
def test_positive_template_upload(self): """Use a template file to populate the job template :id: 976cf310-b2af-41bd-845a-f08baa2e8490 :Setup: Create or use a pre-made job template file :Steps: 1. Create a new job template. 2. Enter a valid name 3. Click the upload button to upload a template from the file 4. Select the file with the desired template :expectedresults: Verify the template correctly imported the file's contents :CaseImportance: Critical """ with Session(self) as session: for name in generate_strings_list(): with self.subTest(name): make_job_template( session, name=name, template_type='file', template_content=OS_TEMPLATE_DATA_FILE, ) self.assertIsNotNone(self.jobtemplate.search(name))
def test_negative_create_with_same_name(self): """Create a new Architecture with same name :id: 4000674e-7b39-4958-8992-1363b25b2cd6 :expectedresults: Architecture is not created :CaseImportance: Critical """ with Session(self) as session: for name in generate_strings_list(): with self.subTest(name): make_arch(session, name=name) self.assertIsNotNone(self.architecture.search(name)) make_arch(session, name=name) self.assertIsNotNone( self.architecture.wait_until_element( common_locators['name_haserror']))
def test_positive_create_with_one_character_name(self): """Create a Partition table with 1 character in name @Assert: Partition table is created @Feature: Partition Table - Positive Create @BZ: 1229384 """ with Session(self.browser) as session: for name in generate_strings_list(length=1): with self.subTest(name): make_partitiontable( session, name=name, template_path=PARTITION_SCRIPT_DATA_FILE, os_family='Red Hat') self.assertIsNotNone(self.partitiontable.search(name))
def test_filtered_datapoint_True(self): """Tests if run_one_datapoint=false returns all data points""" settings.run_one_datapoint = False self.assertEqual(len(generate_strings_list()), 7) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_emails_list()), 10) self.assertEqual(len(invalid_names_list()), 7) self.assertEqual(len(invalid_values_list()), 10) self.assertEqual(len(invalid_usernames_list()), 4) self.assertEqual(len(valid_labels_list()), 2) self.assertEqual(len(valid_data_list()), 7) self.assertEqual(len(valid_emails_list()), 8) self.assertEqual(len(valid_environments_list()), 3) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6)
def test_positive_create(self): """Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone( self.lifecycleenvironment.search(name))
def test_positive_update_name(self): """Update existing role name :id: c3ad9eed-6896-470d-9043-3fda37bbe489 :expectedresults: Role is updated :CaseImportance: Critical """ name = gen_string('utf8') with Session(self) as session: make_role(session, name=name) self.assertIsNotNone(self.role.search(name)) for new_name in generate_strings_list(length=10): with self.subTest(new_name): self.role.update(name, new_name) self.assertIsNotNone(self.role.search(new_name)) name = new_name # for next iteration
def test_positive_update_name(self): """Create Location with valid values then update its name :id: 79d8dbbb-9b7f-4482-a0f5-4fe72713d575 :expectedresults: Location name is updated :CaseImportance: Critical """ loc_name = gen_string('alpha') with Session(self.browser) as session: make_loc(session, name=loc_name) self.assertIsNotNone(self.location.search(loc_name)) for new_name in generate_strings_list(): with self.subTest(new_name): self.location.update(loc_name, new_name=new_name) self.assertIsNotNone(self.location.search(new_name)) loc_name = new_name # for next iteration
def test_positive_update_name(self): """Update usergroup with new name :id: 2f49ab7c-2f11-48c0-99c2-448fc86b5ad2 :expectedresults: Usergroup is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_usergroup(session, name=name) self.assertIsNotNone(self.usergroup.search(name)) for new_name in generate_strings_list(): with self.subTest(new_name): self.usergroup.update(name, new_name) self.assertIsNotNone(self.usergroup.search(new_name)) name = new_name # for next iteration
def test_positive_create(self): """Create a role with name ``name_generator()``. :id: 488a0970-f844-4286-b1eb-dd93005b4580 :expectedresults: An entity can be created without receiving any errors, the entity can be fetched, and the fetched entity has the specified name. :CaseImportance: Critical """ for name in generate_strings_list(exclude_types=['html']): with self.subTest(name): if bz_bug_is_open(1112657) and name in [ 'cjk', 'latin1', 'utf8' ]: self.skipTest('Bugzilla bug 1112657 is open.') self.assertEqual(entities.Role(name=name).create().name, name)
def test_positive_update(self): """Update a role with and give a name of ``name_generator()``. :id: 30cb4b42-24cd-48a0-a3c5-7ca44c060e2e :expectedresults: The role is updated with the given name. :CaseImportance: Critical """ for name in generate_strings_list(exclude_types=['html']): with self.subTest(name): if bz_bug_is_open(1112657) and name in [ 'cjk', 'latin1', 'utf8' ]: self.skipTest('Bugzilla bug 1112657 is open.') role = entities.Role().create() role.name = name self.assertEqual(role.update(['name']).name, name)
def test_positive_update_login_page_footer_text_with_long_string(self): """Attempt to update parameter "Login_page_footer_text" with long length string :id: fb8b0bf1-b475-435a-926b-861aa18d31f1 :expectedresults: Parameter is updated """ login_text_id = [ele.id for ele in entities.Setting().search(query={ "per_page": 200, 'search': 'name="login_text"' })][0] login = entities.Setting(id=login_text_id).read() for login_text in generate_strings_list(1000): with self.subTest(login_text): login.value = login_text login = login.update(['value']) self.assertEqual(login.value, login_text)
def test_positive_delete(self): """Delete a role with name ``name_generator()``. @id: 6e1d9f9c-3cbb-460b-8ef8-4a156e6552a0 @Assert: The role cannot be fetched after it is deleted. """ for name in generate_strings_list(exclude_types=['html']): with self.subTest(name): if bz_bug_is_open(1112657) and name in [ 'cjk', 'latin1', 'utf8' ]: self.skipTest('Bugzilla bug 1112657 is open.') role = entities.Role(name=name).create() self.assertEqual(role.name, name) role.delete() with self.assertRaises(HTTPError): role.read()
def test_positive_update(self): """Update hostgroup with a new name :id: 7c8de1b8-aced-44f0-88a0-dc9e6b83bf7f :expectedresults: Hostgroup is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_hostgroup(session, name=name) self.assertIsNotNone(self.hostgroup.search(name)) for new_name in generate_strings_list(length=4): with self.subTest(new_name): self.hostgroup.update(name, new_name=new_name) self.assertIsNotNone(self.hostgroup.search(new_name)) name = new_name # for next iteration
def test_positive_update_name(self): """Create organization with valid values then update its name. :id: 776f5268-4f05-4cfc-a1e9-339a3e224677 :expectedresults: Organization name is updated successfully :CaseImportance: Critical """ org_name = gen_string('alpha') with Session(self) as session: make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) for new_name in generate_strings_list(): with self.subTest(new_name): self.org.update(org_name, new_name=new_name) self.assertIsNotNone(self.org.search(new_name)) org_name = new_name # for next iteration
def test_positive_create_with_location(self): """Add a location during organization creation :id: 65ee568b-c0c5-4849-969d-02d7a804292c :expectedresults: location is added to organization. :CaseLevel: Integration """ with Session(self): for location_name in generate_strings_list(): with self.subTest(location_name): location = entities.Location(name=location_name).create() self.assertEqual(location.name, location_name) self.assertIsNotNone( self.org.create_with_entity(gen_string('alpha'), 'locations', location_name))
def test_positive_create_with_name(self): """Create Sync Plan with valid name values @id: ceb125a4-449a-4a86-a94f-2a28884e3a41 @Assert: Sync Plan is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_syncplan( session, org=self.organization.name, name=name, description=gen_string('utf8'), sync_interval=choice(valid_sync_intervals()), ) self.assertIsNotNone(self.syncplan.search(name))
def test_positive_update_name(self): """Create new role and update its name :id: 3ce1b337-fd52-4460-b8a8-df49c94ffed1 :expectedresults: Role is created and its name is updated :CaseImportance: Critical """ role = make_role({'name': gen_string('alpha', 15)}) for new_name in generate_strings_list(length=10): with self.subTest(new_name): Role.update({ 'id': role['id'], 'new-name': new_name, }) role = Role.info({'id': role['id']}) self.assertEqual(role['name'], new_name)
def test_positive_create_with_ptable(self): """Add ptable during organization creation :id: a33f66f0-0d89-11e7-abd9-68f72889dc7f :expectedresults: Partition table is added. :CaseLevel: Integration """ with Session(self): for ptable_name in generate_strings_list(): with self.subTest(ptable_name): # Create partition table using nailgun ptable = entities.PartitionTable(name=ptable_name).create() self.assertEqual(ptable.name, ptable_name) self.assertIsNotNone( self.org.create_with_entity(gen_string('alpha'), 'ptables', ptable_name))
def test_positive_create_with_name(self): """Create Sync Plan with valid name values @Feature: Content Sync Plan - Positive Create @Assert: Sync Plan is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_syncplan( session, org=self.organization.name, name=name, description=gen_string('utf8'), sync_interval=valid_sync_intervals()[randint(0, 2)], ) self.assertIsNotNone(self.syncplan.search(name))
def test_positive_delete(self): """Delete an existing template :id: e4a687e5-6581-4481-ad9b-8d2ac3f2c9d5 :expectedresults: Template is deleted successfully :CaseImportance: Critical """ with Session(self) as session: session.nav.go_to_select_org(self.organization.name) for template_name in generate_strings_list(): with self.subTest(template_name): entities.ConfigTemplate( name=template_name, organization=[self.organization], ).create() self.template.delete(template_name, dropdown_present=True)
def test_return_type(self): """This test validates return types for functions: 1. :meth:`robottelo.datafactory.generate_strings_list` 2. :meth:`robottelo.datafactory.invalid_emails_list` 3. :meth:`robottelo.datafactory.invalid_names_list` 4. :meth:`robottelo.datafactory.valid_data_list` 5. :meth:`robottelo.datafactory.valid_docker_repository_names` 6. :meth:`robottelo.datafactory.valid_emails_list` 7. :meth:`robottelo.datafactory.valid_environments_list` 8. :meth:`robottelo.datafactory.valid_hosts_list` 9. :meth:`robottelo.datafactory.valid_hostgroups_list` 10. :meth:`robottelo.datafactory.valid_labels_list` 11. :meth:`robottelo.datafactory.valid_names_list` 12. :meth:`robottelo.datafactory.valid_org_names_list` 13. :meth:`robottelo.datafactory.valid_usernames_list` 14. :meth:`robottelo.datafactory.invalid_id_list` 15. :meth:`robottelo.datafactory.invalid_interfaces_list` 16. :meth:`robottelo.datafactory.valid_interfaces_list` 17. :meth:`robottelo.datafactory.valid_cron_expressions` """ for item in itertools.chain( datafactory.generate_strings_list(), datafactory.invalid_emails_list(), datafactory.invalid_interfaces_list(), datafactory.invalid_names_list(), datafactory.valid_data_list(), datafactory.valid_docker_repository_names(), datafactory.valid_emails_list(), datafactory.valid_environments_list(), datafactory.valid_hosts_list(), datafactory.valid_hostgroups_list(), datafactory.valid_interfaces_list(), datafactory.valid_labels_list(), datafactory.valid_names_list(), datafactory.valid_org_names_list(), datafactory.valid_cron_expressions(), datafactory.valid_usernames_list(), ): assert isinstance(item, str) for item in datafactory.invalid_id_list(): if not (isinstance(item, (str, int)) or item is None): pytest.fail('Unexpected data type')
def test_positive_update_login_page_footer_text_with_long_string(self): """Attempt to update parameter "Login_page_footer_text" with long length string under General tab :id: 87ef6b19-fdc5-4541-aba8-e730f1a3caa7 :steps: 1. Execute "settings" command with "set" as sub-command with long length string :expectedresults: Parameter is updated :CaseImportance: Low """ for login_text_value in generate_strings_list(1000): with self.subTest(login_text_value): Settings.set({'name': "login_text", 'value': login_text_value}) login_text = Settings.list({'search': 'name=login_text'})[0] self.assertEqual(login_text_value, login_text['value'])
def test_positive_update_name(self): """Create a Partition Table and update its name :id: 6242c915-0f15-4d5f-9f7a-73cb58fac81e :expectedresults: Partition Table is created and its name can be updated :CaseImportance: Critical """ ptable = make_partition_table() for new_name in generate_strings_list(length=randint(4, 30)): with self.subTest(new_name): PartitionTable.update({ 'id': ptable['id'], 'new-name': new_name, }) ptable = PartitionTable.info({'id': ptable['id']}) self.assertEqual(ptable['name'], new_name)
def test_positive_create_with_name(self): """Create a new partition table :id: 2dd8e34d-5a39-49d0-9bde-dd1cdfddb2ad :expectedresults: Partition table is created :CaseImportance: Critical """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_partitiontable( session, name=name, template_path=PARTITION_SCRIPT_DATA_FILE, os_family='Red Hat', ) self.assertIsNotNone(self.partitiontable.search(name))
def test_negative_create_with_same_name(self): """Create organization with valid names, then create a new one with same names. :id: d7fd91aa-1a0e-4403-8dea-cc03cbb93070 :expectedresults: organization is not created :CaseImportance: Critical """ with Session(self) as session: for org_name in generate_strings_list(): with self.subTest(org_name): make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) self.org.create(org_name) error = session.nav.wait_until_element( common_locators['name_haserror']) self.assertIsNotNone(error)
def test_positive_update_name_and_os(self): """Update Architecture with new name and OS @Feature: Architecture - Update @Assert: Architecture is updated """ old_name = gen_string('alpha') with Session(self.browser) as session: make_arch(session, name=old_name) self.assertIsNotNone(self.architecture.search(old_name)) for new_name in generate_strings_list(): with self.subTest(new_name): os_name = gen_string('alpha') entities.OperatingSystem(name=os_name).create() self.architecture.update( old_name, new_name, new_os_names=[os_name]) self.assertIsNotNone(self.architecture.search(new_name)) old_name = new_name # for next iteration
def test_filtered_datapoint_False(self): """Tests if run_one_datapoint=True returns one data point""" settings.run_one_datapoint = True self.assertEqual(len(generate_strings_list()), 1) self.assertEqual(len(invalid_emails_list()), 1) self.assertEqual(len(invalid_id_list()), 1) self.assertEqual(len(invalid_interfaces_list()), 1) self.assertEqual(len(invalid_names_list()), 1) self.assertEqual(len(invalid_values_list()), 1) self.assertEqual(len(valid_data_list()), 1) self.assertEqual(len(valid_emails_list()), 1) self.assertEqual(len(valid_environments_list()), 1) self.assertEqual(len(valid_hosts_list()), 1) self.assertEqual(len(valid_hostgroups_list()), 1) self.assertEqual(len(valid_interfaces_list()), 1) self.assertEqual(len(valid_labels_list()), 1) self.assertEqual(len(valid_names_list()), 1) self.assertEqual(len(valid_org_names_list()), 1) self.assertEqual(len(valid_usernames_list()), 1)
def test_positive_update(self): """Update selected config-group :id: c8589969-1fdb-4977-b973-3795a36704be :expectedresults: Config-Groups is updated. :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_config_groups(session, name=name) self.assertIsNotNone(self.configgroups.search(name)) for new_name in generate_strings_list(): with self.subTest(new_name): self.configgroups.update(name, new_name) self.assertIsNotNone(self.configgroups.search(new_name)) name = new_name
def test_positive_delete(self): """Delete an existing Sync plan :id: 81beec05-e38c-48bc-8f01-10cb1e10a3f6 :expectedresults: Sync Plan is deleted successfully :CaseImportance: Critical """ with Session(self) as session: for plan_name in generate_strings_list(): with self.subTest(plan_name): entities.SyncPlan( name=plan_name, interval=SYNC_INTERVAL['day'], organization=self.organization, ).create() session.nav.go_to_select_org(self.organization.name) self.syncplan.delete(plan_name)
def test_positive_delete_by_id(self): """Check if content host can be created and deleted @Feature: Content Hosts @Assert: Content host is created and then deleted """ for name in generate_strings_list(): with self.subTest(name): new_system = make_content_host({ u'content-view-id': self.DEFAULT_CV['id'], u'lifecycle-environment-id': self.LIBRARY['id'], u'name': name, u'organization-id': self.NEW_ORG['id'], }) ContentHost.delete({u'id': new_system['id']}) with self.assertRaises(CLIReturnCodeError): ContentHost.info({'id': new_system['id']})
def test_return_type(self): """This test validates return types for functions: 1. :meth:`robottelo.datafactory.generate_strings_list` 2. :meth:`robottelo.datafactory.invalid_emails_list` 3. :meth:`robottelo.datafactory.invalid_names_list` 4. :meth:`robottelo.datafactory.valid_data_list` 5. :meth:`robottelo.datafactory.valid_docker_repository_names` 6. :meth:`robottelo.datafactory.valid_emails_list` 7. :meth:`robottelo.datafactory.valid_environments_list` 8. :meth:`robottelo.datafactory.valid_hosts_list` 9. :meth:`robottelo.datafactory.valid_hostgroups_list` 10. :meth:`robottelo.datafactory.valid_labels_list` 11. :meth:`robottelo.datafactory.valid_names_list` 12. :meth:`robottelo.datafactory.valid_org_names_list` 13. :meth:`robottelo.datafactory.valid_usernames_list` 14. :meth:`robottelo.datafactory.invalid_id_list` 15. :meth:`robottelo.datafactory.invalid_interfaces_list` 16. :meth:`robottelo.datafactory.valid_interfaces_list` """ with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=False): for item in itertools.chain(generate_strings_list(), invalid_emails_list(), invalid_interfaces_list(), invalid_names_list(), valid_data_list(), valid_docker_repository_names(), valid_emails_list(), valid_environments_list(), valid_hosts_list(), valid_hostgroups_list(), valid_interfaces_list(), valid_labels_list(), valid_names_list(), valid_org_names_list(), valid_usernames_list()): self.assertIsInstance(item, six.text_type) for item in invalid_id_list(): if not (isinstance(item, (six.text_type, int)) or item is None): self.fail('Unexpected data type')