def test_negative_create_job_template_with_invalid_name(self): """Create Job Template with invalid name @id: eb51afd4-e7b3-42c3-81c3-6e18ef3d7efe @Assert: Job Template with invalid name cannot be created and error is raised """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaisesRegex(CLIFactoryError, u"Could not create the job template:"): for name in invalid_values_list(): make_job_template( {u"organizations": self.organization["name"], u"name": name, u"file": TEMPLATE_FILE} )
def test_negative_create_with_invalid_name(self): """Create a bookmark with invalid name @id: 9a79c561-8225-43fc-8ec7-b6858e9665e2 @Steps: 1. Attempt to create a bookmark with providing an invalid name 2. List the bookmarks @Assert: Error returned, Bookmark is not created (not listed) """ for entity in BOOKMARK_ENTITIES: with self.subTest(entity['controller']): for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Bookmark( controller=entity['controller'], name=name, public=False, ).create() result = entities.Bookmark().search( query={'search': u'name="{0}"'.format(name)}) self.assertEqual(len(result), 0)
def test_negative_update_invalid_name(self): """Update a bookmark with an invalid name @id: 479795bb-aeed-45b3-a7e3-d3449c808087 @Setup: 1. Create a bookmark with a random name and random query @Steps: 1. Update the name of the previously created bookmarks to an invalid value @Assert: Error - bookmark not updated """ for entity in BOOKMARK_ENTITIES: with self.subTest(entity['controller']): bm = entities.Bookmark( controller=entity['controller'], public=False, ).create() for new_name in invalid_values_list(): with self.subTest(new_name): bm.name = new_name with self.assertRaises(HTTPError): bm.update(['name']) bm = bm.read() self.assertNotEqual(bm.name, new_name)
def test_negative_create_with_invalid_name(self): """@Test: Create OpenScap content with negative values @Feature: OpenScap - Negative Create. @Steps: 1. Create an openscap content. 2. Provide all the appropriate parameters. @Assert: Creating content for OpenScap is not successful. @BZ: 1289571 """ with Session(self.browser) as session: for content_name in invalid_values_list(interface='ui'): with self.subTest(content_name): set_context(session, org=ANY_CONTEXT['org']) make_oscapcontent( session, name=content_name, content_path=self.content_path, ) self.assertIsNotNone(session.nav.wait_until_element( common_locators['haserror']))
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_emails_list()), 8) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_interfaces_list()), 8) 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()), 4) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_interfaces_list()), 3) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6) self.assertEqual(len((valid_cron_expressions())), 4) with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=True): self.assertEqual(len(valid_docker_repository_names()), 6) with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=False): self.assertEqual(len(valid_docker_repository_names()), 7)
def test_negative_create_with_invalid_name(self): """Create OpenScap Policy with negative values. @id: dfebf26b-194f-473d-b5a6-9061c520f57e @Steps: 1. Create an openscap content. 2. Create an openscap Policy. 3. Provide all the appropriate parameters. @Assert: Creating Policy for OpenScap is not successful. @BZ: 1293296 """ content_name = gen_string('alpha') with Session(self.browser) as session: make_oscapcontent( session, name=content_name, content_path=self.content_path, ) self.assertIsNotNone( self.oscapcontent.search(content_name)) for policy_name in invalid_values_list(interface='ui'): with self.subTest(policy_name): make_oscappolicy( session, content=content_name, name=policy_name, period=OSCAP_PERIOD['weekly'], profile=OSCAP_PROFILE['c2s_rhel6'], period_value=OSCAP_WEEKDAY['friday'], ) self.assertIsNone(self.oscappolicy.search(policy_name))
def test_negative_update_name(self): """Update discovery rule name using invalid names only :id: 65f32628-796a-4d7e-bf2c-c84c6b06f309 :expectedresults: Rule name is not updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_name in invalid_values_list(interface='ui'): with self.subTest(new_name): self.discoveryrules.update(name=name, new_name=new_name) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror']) ) self.assertIsNone(self.discoveryrules.search(new_name))
def test_negative_create_with_parameter_and_invalid_separator(self): """Subnet parameters can not be created with name with invalid separators :id: 08d10b75-a0db-4a11-a915-965a2a207d16 :steps: 1. Create Subnet with all the details 2. Create subnet parameter having key with name separated by invalid separators(e.g spaces) and value :expectedresults: 1. The parameter with name separated by invalid separators should not be saved in subnet 2. An error for invalid name should be thrown. """ subnet = entities.Subnet().create() invalid_values = invalid_values_list() + ['name with space'] for name in invalid_values: with self.subTest(name): with self.assertRaises(HTTPError): entities.Parameter( name=name, subnet=subnet.id ).create()
def test_negative_update_parameter(self): """Subnet parameter can not be updated with invalid names :id: fcdbad13-ad96-4152-8e20-e023d61a2853 :steps: 1. Create valid subnet with valid parameter 2. Update above subnet parameter with some invalid name. e.g name with spaces :expectedresults: 1. The parameter should not be updated with invalid name 2. An error for invalid name should be thrown """ subnet = entities.Subnet().create() sub_param = entities.Parameter( name=gen_string('utf8'), subnet=subnet.id, value=gen_string('utf8') ).create() invalid_values = invalid_values_list() + ['name with space'] for new_name in invalid_values: with self.subTest(new_name): with self.assertRaises(HTTPError): sub_param.name = new_name sub_param.update(['name'])
def test_negative_create_job_template(self): """Create Job Template with invalid name :id: 79342781-1369-4d1f-a512-ca1a809d98fb :Steps: 1. Navigate to Hosts -> Job Templates 2. Enter an invalid name 3. Click submit :expectedresults: Job Template with invalid name cannot be created and error is raised :CaseImportance: Critical """ with Session(self) as session: for name in invalid_values_list('ui'): with self.subTest(name): make_job_template( session, name=name, template_type='input', template_content=gen_string('alphanumeric', 20), ) self.assertIsNotNone(self.jobtemplate.wait_until_element( common_locators['name_haserror']))
def test_negative_create_with_invalid_name(self): """Create OpenScap content with negative values :id: 8ce0e8b4-396a-43cd-8cbe-fb60fcf853b0 :Steps: 1. Create an openscap content. 2. Provide all the appropriate parameters. :expectedresults: Creating content for OpenScap is not successful. :BZ: 1289571 :CaseImportance: Critical """ with Session(self) as session: for content_name in invalid_values_list(interface='ui'): with self.subTest(content_name): make_oscapcontent( session, name=content_name, content_path=self.content_path, content_org=self.org_name, ) self.assertIsNotNone(session.nav.wait_until_element( common_locators['haserror']))
def test_negative_update_with_name(self): """@Test: Try to update content view filter using invalid names only @Feature: Content View Filter @Assert: Content view filter is not updated """ cvf_name = gen_string('utf8') ContentView.filter_create({ 'content-view-id': self.content_view['id'], 'name': cvf_name, 'type': 'rpm', }) for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): ContentView.filter_update({ 'content-view-id': self.content_view['id'], 'name': cvf_name, 'new-name': new_name, }) with self.assertRaises(CLIReturnCodeError): ContentView.filter_info({ u'content-view-id': self.content_view['id'], u'name': new_name, })
def test_negative_create_with_name(self): """Don't create an Environment with invalid data. @Feature: Environment @Assert: Environment is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Environment.create({'name': name})
def test_negative_create_with_name(self): """Check if syncplan can be created with random names @Feature: Sync Plan @Assert: Sync plan is created and has random name """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): self._make_sync_plan({u'name': name})
def test_negative_create_with_name(self): """Repository name cannot be 300-characters long @id: af0652d3-012d-4846-82ac-047918f74722 @Assert: Repository cannot be created """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): self._make_repository({u'name': name})
def test_negative_create_with_name(self): """Attempt to create new location using invalid names only @Assert: Location is not created and expected error is raised @Feature: Location """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Location(name=name).create()
def test_negative_create_with_invalid_name(self): """Try to create media entity providing an invalid name @id: 0934f4dc-f674-40fe-a639-035761139c83 @Assert: Media entity is not created """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Media(name=name).create()
def test_negative_create_with_invalid_name(self): """Create Activation key with invalid Name @Feature: Activation key - Negative Create @Assert: Activation key is not created. Appropriate error shown. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): self._make_activation_key({u"name": name})
def test_negative_create_with_name(self): """Attempt to create user group with invalid name. @id: 1a3384dc-5d52-442c-87c8-e38048a61dfa @Assert: User group is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.UserGroup(name=name).create()
def test_negative_create_with_name(self): """Don't create an HostGroup with invalid data. @id: 853a6d43-129a-497b-94f0-08dc622862f8 @Assert: HostGroup is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): HostGroup.create({'name': name})
def test_negative_create_name(self): """Attempt to create repository with invalid names only. @Assert: A repository is not created and error is raised. @Feature: Repository """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Repository(name=name).create()
def test_negative_create_with_invalid_name(self): """@Test: Try to create partition table using invalid names only @Assert: Partition table was not created @Feature: Partition Table - Create """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.PartitionTable(name=name).create()
def test_negative_create_with_name(self): """Repository name cannot be 300-characters long @Feature: Repository @Assert: Repository cannot be created """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): self._make_repository({u'name': name})
def test_negative_create_with_invalid_name(self): """Create an org with an incorrect name. @id: 9c6a4b45-a98a-4d76-9865-92d992fa1a22 @Assert: The organization cannot be created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Organization(name=name).create()
def test_negative_create_with_name(self): """Create Operating System using invalid names @id: 848a20ce-292a-47d8-beea-da5916c43f11 @assert: Operating System is not created """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): make_os({'name': name})
def test_negative_create_with_name(self): """Don't create an Architecture with invalid data. @Feature: Architecture @Assert: Architecture is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Architecture.create({'name': name})
def test_negative_create_with_invalid_name(self): """Create Activation key with invalid Name @id: d9b7e3a9-1d24-4e47-bd4a-dce75772d829 @Assert: Activation key is not created. Appropriate error shown. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): self._make_activation_key({u'name': name})
def test_negative_create(self): """@Test: Don't create an Model with invalid data. @Feature: Model @Assert: Model is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Model.create({'name': name})
def test_negative_create_with_name(self): """Don't create an Architecture with invalid data. @id: cfed972e-9b09-4852-bdd2-b5a8a8aed170 @Assert: Architecture is not created. """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): Architecture.create({'name': name})
def test_negative_create_with_name(self): """Attempt to create new location using invalid names only @id: 320e6bca-5645-423b-b86a-2b6f35c8dae3 @Assert: Location is not created and expected error is raised """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.Location(name=name).create()
def test_negative_create_with_invalid_name(self): """Create Activation key with invalid Name :id: d9b7e3a9-1d24-4e47-bd4a-dce75772d829 :expectedresults: Activation key is not created. Appropriate error shown. :CaseImportance: Critical """ for name in invalid_values_list(): with self.subTest(name), self.assertRaises( CLIFactoryError) as raise_ctx: self._make_activation_key({u'name': name}) self.assert_error_msg( raise_ctx, u'Validation failed:', name )
def test_negative_update_name(self): """Update the Environment with invalid values :id: adc5ad73-0547-40f9-b4d4-649780cfb87a :expectedresults: Environment is not updated :CaseImportance: Critical """ environment = make_environment() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Environment.update({ 'id': environment['id'], 'new-name': new_name, }) result = Environment.info({'id': environment['id']}) self.assertEqual(environment['name'], result['name'])
def test_negative_create_with_invalid_name(self): """Create Sync Plan with invalid names @id: 64724669-0289-4e8a-a44d-eb47e094ef18 @Assert: Sync Plan is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_syncplan( session, org=self.organization.name, name=name, description='invalid name', ) self.assertIsNotNone( self.syncplan.wait_until_element( common_locators['common_invalid']))
def test_negative_update_name(self): """Create gpg key with valid name and valid gpg key via file import then fail to update its name :id: 938d2925-c82c-43b6-8dfc-29c42eca7424 :expectedresults: gpg key is not updated :CaseImportance: Critical """ gpg_key = make_gpg_key({'organization-id': self.org['id']}) for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): GPGKey.update({ 'name': gpg_key['name'], 'new-name': new_name, 'organization-id': self.org['id'], })
def test_negative_update_name(self): """Attempt to update Compute Profile entity using invalid names only :id: 042b40d5-a78b-4e65-b5cb-5b270b800b37 :expectedresults: Compute Profile is not updated. :CaseImportance: Critical :CaseLevel: Component """ profile = entities.ComputeProfile().create() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(HTTPError): entities.ComputeProfile(id=profile.id, name=new_name).update(['name']) updated_profile = entities.ComputeProfile(id=profile.id).read() self.assertNotEqual(new_name, updated_profile.name)
def test_negative_update_name(self): """Negative update of system name :id: 4b18ff6d-7728-4245-a1ce-38e62c05f454 :expectedresults: Operating System name is not updated :CaseImportance: Critical """ os = make_os({'name': gen_alphanumeric()}) for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): OperatingSys.update({ 'id': os['id'], 'name': new_name, }) result = OperatingSys.info({'id': os['id']}) self.assertEqual(result['name'], os['name'])
def test_negative_create_with_name(self): """Attempt to create host collection with invalid name of different types :id: 92a9eff0-693f-4ab8-b2c4-de08e5f709a7 :expectedresults: Host collection is not created and error is raised :CaseImportance: Critical """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIFactoryError): make_host_collection({ 'name': name, 'organization-id': self.organization['id'] })
def test_negative_create_with_invalid_name(self): """Create partition table with invalid names @Feature: Partition table - Negative Create @Assert: Partition table is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_partitiontable( session, name=name, template_path=PARTITION_SCRIPT_DATA_FILE, os_family='Red Hat', ) self.assertIsNotNone( self.partitiontable.wait_until_element( common_locators['name_haserror']))
def test_negative_create_with_invalid_name(self): """Try to create content view filter using invalid names only :id: f3497a23-6e34-4fee-9964-f95762fc737c :expectedresults: Content view filter is not created :CaseImportance: Critical """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(CLIReturnCodeError): ContentView.filter.create({ 'content-view-id': self.content_view['id'], 'name': name, 'organization-id': self.org['id'], 'type': 'rpm', })
def test_negative_create_with_invalid_name(self): """Create Discovery Rule with invalid names :id: 79d950dc-4ca1-407e-84ca-9092d1cba978 :expectedresults: Error should be raised and rule should not be created :CaseImportance: Critical """ with Session(self) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror'])) self.assertIsNone(self.discoveryrules.search(name))
def test_negative_update_name(self): """Create Model then fail to update its name :id: 98020a4a-1789-4df3-929c-6c132b57f5a1 :expectedresults: Model name is not updated :CaseImportance: Critical """ model = make_model() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): Model.update({ 'id': model['id'], 'new-name': new_name, }) result = Model.info({'id': model['id']}) self.assertEqual(model['name'], result['name'])
def test_negative_create_with_name(self): """Create Host Collections with invalid name :id: 04e36c46-7577-4308-b9bb-4ec74549d9d3 :expectedresults: Host Collection is not created and appropriate error message thrown :CaseImportance: Critical """ with Session(self) as session: for name in invalid_values_list('ui'): with self.subTest(name): make_host_collection(session, org=self.organization.name, name=name) self.assertIsNotNone( self.hostcollection.wait_until_element( common_locators['common_invalid']))
def test_negative_add_parameter(self): """Try to add host parameter with different invalid names. @id: 473f8c3f-b66e-4526-88af-e139cc3dabcb @Assert: Host parameter was not added. """ for name in invalid_values_list(): with self.subTest(name): name = name.lower() with self.assertRaises(CLIReturnCodeError): Host.set_parameter({ 'host-id': self.host['id'], 'name': name, 'value': gen_string('alphanumeric'), }) self.host = Host.info({'id': self.host['id']}) self.assertNotIn(name, self.host['parameters'].keys())
def test_negative_update_name(self): """Create HostGroup then fail to update its name :id: 42d208a4-f518-4ff2-9b7a-311adb460abd :expectedresults: HostGroup name is not updated :CaseImportance: Critical """ hostgroup = make_hostgroup() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): HostGroup.update({ 'id': hostgroup['id'], 'new-name': new_name, }) result = HostGroup.info({'id': hostgroup['id']}) self.assertEqual(hostgroup['name'], result['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_negative_update(self): """Attempt to update Compute Profile entity using invalid names only :id: cf7d46c2-6edc-43be-b5d4-ba92f10b921b :expectedresults: Compute Profile is not updated. :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_compute_profile(session, name=name) self.assertIsNotNone(self.compute_profile.search(name)) for new_name in invalid_values_list('ui'): with self.subTest(new_name): self.compute_profile.update(name, new_name) self.assertIsNotNone( session.nav.wait_until_element( common_locators['name_haserror']))
def test_negative_create_with_invalid_name(self): """Create Content Product with invalid names @id: 11efd16c-6471-4191-934f-79c7278c66e8 @Assert: Product is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_product( session, org=self.organization.name, loc=self.loc.name, name=name, description=gen_string('alphanumeric'), ) self.assertIsNotNone(self.products.wait_until_element( common_locators['common_invalid']))
def test_negative_update_name(self): """Update lifecycle environment providing an invalid name @Feature: Lifecycle Environment @Assert: Lifecycle environment is not updated and corresponding error is raised """ name = gen_string('alpha') lc_env = entities.LifecycleEnvironment( organization=self.org, name=name, ).create() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(HTTPError): entities.LifecycleEnvironment( id=lc_env.id, name=new_name).update(['name']) self.assertEqual(lc_env.read().name, name)
def test_negative_set_parameter_with_too_long_values(self): """Set OS parameter with name and value exceeding 255 characters @Feature: OS - Negative Update @Assert: Proper error should be raised, Name should contain a value """ os_name = entities.OperatingSystem().create().name with Session(self.browser): for param in invalid_values_list(interface='ui'): with self.subTest(param): try: self.operatingsys.set_os_parameter( os_name, param, param) except UIError as err: self.fail(err) self.assertIsNotNone( self.operatingsys.wait_until_element( common_locators['common_param_error']))
def test_negative_create_with_invalid_name(self): """Create new subnet with invalid names @id: d53056ad-a219-40d5-b20e-95ad343c9d38 @Assert: Subnet is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_subnet( session, subnet_name=name, subnet_network=gen_ipaddr(ip3=True), subnet_mask=gen_netmask(), ) self.assertIsNotNone( session.nav.wait_until_element( common_locators['haserror']))
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_negative_update_name(self): """Try to update Activation Key using invalid value for its name @id: b75e7c38-fde2-4110-ba65-4157319fc159 @Assert: Activation key is not updated. Appropriate error shown. """ new_ak = self._make_activation_key() for name in invalid_values_list(): with self.subTest(name), self.assertRaises( CLIReturnCodeError) as raise_ctx: ActivationKey.update({ u'id': new_ak['id'], u'new-name': name, u'organization-id': self.org['id'], }) self.assert_error_msg( raise_ctx, u'Could not update the activation key:' )
def test_negative_update_invalid_name(self): """Attempt to update compute resource with invalid names @Feature: Compute Resource @Assert: Compute resource is not updated """ name = gen_string('alphanumeric') compresource = entities.LibvirtComputeResource( location=[self.loc], name=name, organization=[self.org], url=self.current_libvirt_url, ).create() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(HTTPError): compresource.name = new_name compresource.update(['name']) self.assertEqual(compresource.read().name, name)
def test_negative_create_with_invalid_name(self): """Attempt to create compute resources with invalid names :id: f73bf838-3ffd-46d3-869c-81b334b47b13 :expectedresults: Compute resources are not created :CaseImportance: High :CaseLevel: Component """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaises(HTTPError): entities.LibvirtComputeResource( location=[self.loc], name=name, organization=[self.org], url=self.current_libvirt_url, ).create()
def test_negative_update_by_id(self): """Attempt to update existing user group using different invalid names. Use id of the user group as a parameter :id: e5aecee1-7c4c-4ac5-aee2-a3190cbe956f :expectedresults: User group is not updated. :CaseImportance: Critical """ user_group = make_usergroup() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): UserGroup.update({ 'id': user_group['id'], 'new-name': new_name, }) user_group = UserGroup.info({'id': user_group['id']}) self.assertNotEqual(user_group['name'], new_name)
def test_negative_create_job_template_with_invalid_name(self): """Create Job Template with invalid name :id: eb51afd4-e7b3-42c3-81c3-6e18ef3d7efe :expectedresults: Job Template with invalid name cannot be created and error is raised :CaseImportance: Critical """ for name in invalid_values_list(): with self.subTest(name): with self.assertRaisesRegex(CLIFactoryError, 'Could not create the job template:'): make_job_template( { 'organizations': self.organization['name'], 'name': name, 'file': TEMPLATE_FILE, } )
def test_negative_update_by_name(self): """Attempt to update existing user group using different invalid names. Use name of the user group as a parameter :id: 32ad14cf-4ed8-4deb-b2fc-df4ed60efb78 :expectedresults: User group is not updated. :CaseImportance: Critical """ user_group = make_usergroup() for new_name in invalid_values_list(): with self.subTest(new_name): with self.assertRaises(CLIReturnCodeError): UserGroup.update({ 'name': user_group['name'], 'new-name': new_name, }) user_group = UserGroup.info({'id': user_group['id']}) self.assertNotEqual(user_group['name'], new_name)
def test_negative_update_name(self): """Attempt to update a hostgroup with invalid names :id: 6d8c4738-a0c4-472b-9a71-27c8a3832335 :expectedresults: A hostgroup is not updated :CaseImportance: Critical """ hostgroup = entities.HostGroup( location=[self.loc], organization=[self.org], ).create() original_name = hostgroup.name for new_name in invalid_values_list(): with self.subTest(new_name): hostgroup.name = new_name with self.assertRaises(HTTPError): hostgroup.update(['name']) self.assertEqual(hostgroup.read().name, original_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_emails_list()), 8) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_interfaces_list()), 8) 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()), 4) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_interfaces_list()), 3) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6)
def test_negative_set_parameter_with_too_long_values(self): """Set OS parameter with name and value exceeding 255 characters :id: e961ce00-f86b-476e-afad-468491cb2a12 :expectedresults: Proper error should be raised, Name should contain a value """ os_name = entities.OperatingSystem().create().name with Session(self): for param in invalid_values_list(interface='ui'): with self.subTest(param): try: self.operatingsys.set_os_parameter( os_name, param, param) except UIError as err: self.fail(err) self.assertIsNotNone( self.operatingsys.wait_until_element( common_locators['table_haserror']))