def test_positive_filter_option(self, form_data, virtwho_config): """ Verify filter option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: 89cc1134-69d9-4da8-9ba9-a296c17f4f16 :expectedresults: filter and filter_hosts can be updated. :CaseLevel: Integration :CaseImportance: Medium """ whitelist = {'filtering_mode': '1', 'whitelist': '.*redhat.com'} blacklist = {'filtering_mode': '2', 'blacklist': '.*redhat.com'} if settings.virtwho.hypervisor_type == 'esx': whitelist['filter_host_parents'] = '.*redhat.com' blacklist['exclude_host_parents'] = '.*redhat.com' # Update Whitelist and check the result virtwho_config.filtering_mode = whitelist['filtering_mode'] virtwho_config.whitelist = whitelist['whitelist'] if settings.virtwho.hypervisor_type == 'esx': virtwho_config.filter_host_parents = whitelist[ 'filter_host_parents'] virtwho_config.update(whitelist.keys()) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id) deploy_configure_by_command(command) assert get_configure_option('filter_hosts', config_file) == whitelist['whitelist'] if settings.virtwho.hypervisor_type == 'esx': assert (get_configure_option( 'filter_host_parents', config_file) == whitelist['filter_host_parents']) # Update Blacklist and check the result virtwho_config.filtering_mode = blacklist['filtering_mode'] virtwho_config.blacklist = blacklist['blacklist'] if settings.virtwho.hypervisor_type == 'esx': virtwho_config.exclude_host_parents = blacklist[ 'exclude_host_parents'] virtwho_config.update(blacklist.keys()) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id) deploy_configure_by_command(command) assert get_configure_option('exclude_hosts', config_file) == blacklist['blacklist'] if settings.virtwho.hypervisor_type == 'esx': assert (get_configure_option( 'exclude_host_parents', config_file) == blacklist['exclude_host_parents']) virtwho_config.delete() assert not entities.VirtWhoConfig().search( query={'search': f"name={form_data['name']}"})
def test_positive_filter_option(self, default_org, form_data, virtwho_config): """Verify filter option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: 1f251d89-5e22-4470-be4c-0aeba84c0273 :expectedresults: filter and filter_hosts can be updated. :CaseLevel: Integration :CaseImportance: Medium """ whitelist = {'filtering_mode': '1', 'whitelist': '.*redhat.com'} blacklist = {'filtering_mode': '2', 'blacklist': '.*redhat.com'} # esx support filter-host-parents and exclude-host-parents options whitelist['filter_host_parents'] = '.*redhat.com' blacklist['exclude_host_parents'] = '.*redhat.com' # Update Whitelist and check the result virtwho_config.filtering_mode = whitelist['filtering_mode'] virtwho_config.whitelist = whitelist['whitelist'] virtwho_config.filter_host_parents = whitelist['filter_host_parents'] virtwho_config.update(whitelist.keys()) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id, default_org.name) deploy_configure_by_command(command, form_data['hypervisor_type'], org=default_org.label) assert get_configure_option('filter_hosts', config_file) == whitelist['whitelist'] assert (get_configure_option( 'filter_host_parents', config_file) == whitelist['filter_host_parents']) # Update Blacklist and check the result virtwho_config.filtering_mode = blacklist['filtering_mode'] virtwho_config.blacklist = blacklist['blacklist'] virtwho_config.exclude_host_parents = blacklist['exclude_host_parents'] virtwho_config.update(blacklist.keys()) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id, default_org.name) deploy_configure_by_command(command, form_data['hypervisor_type'], org=default_org.label) assert get_configure_option('exclude_hosts', config_file) == blacklist['blacklist'] assert (get_configure_option( 'exclude_host_parents', config_file) == blacklist['exclude_host_parents']) virtwho_config.delete() assert not entities.VirtWhoConfig().search( query={'search': f"name={form_data['name']}"})
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """ Verify hypervisor_id option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: 9aa17bbc-e417-473a-831c-4d87781f41d8 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] if settings.virtwho.hypervisor_type in ('esx', 'rhevm'): values.append('hwuuid') for value in values: virtwho_config.hypervisor_id = value virtwho_config.update(['hypervisor_id']) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id) deploy_configure_by_command(command) assert get_configure_option('hypervisor_id', config_file) == value virtwho_config.delete() assert not entities.VirtWhoConfig().search(query={'search': f"name={form_data['name']}"})
def test_positive_hypervisor_id_option(self, default_org, form_data, virtwho_config): """Verify hypervisor_id option by hammer virt-who-config update" :id: 082a0eec-f024-4605-b876-a8959cf68e0c :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] for value in values: VirtWhoConfig.update({ 'id': virtwho_config['id'], 'hypervisor-id': value }) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['hypervisor-id'] == value config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id'], default_org.name) deploy_configure_by_command(command, form_data['hypervisor-type'], org=default_org.label) assert get_configure_option('hypervisor_id', config_file) == value VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_post_crud_virt_who_configuration(self): """Virt-who config is intact post upgrade and verify the config can be updated and deleted. :id: postupgrade-d7ae7b2b-3291-48c8-b412-cb54e444c7a4 :steps: 1. Post upgrade, Verify virt-who exists and has same status. 2. Verify the connection of the guest on Content host. 3. Verify the virt-who config-file exists. 4. Update virt-who config with new name. 5. Delete virt-who config. :expectedresults: 1. virt-who config is intact post upgrade. 2. the config and guest connection have the same status. 3. virt-who config should update and delete successfully. """ org = entities.Organization().search(query={'search': 'name={0}'.format(self.org_name)})[0] # Post upgrade, Verify virt-who exists and has same status. vhd = entities.VirtWhoConfig(organization_id=org.id).search( query={'search': 'name={}'.format(self.name)} )[0] if not is_open('BZ:1802395'): self.assertEqual(vhd.status, 'ok') # Verify virt-who status via CLI as we cannot check it via API now vhd_cli = VirtWhoConfig.exists(search=('name', self.name)) self.assertEqual( VirtWhoConfig.info({'id': vhd_cli['id']})['general-information']['status'], 'OK' ) # Vefify the connection of the guest on Content host entity_data = get_entity_data(self.__class__.__name__) hypervisor_name = entity_data.get('hypervisor_name') guest_name = entity_data.get('guest_name') hosts = [hypervisor_name, guest_name] for hostname in hosts: result = ( entities.Host(organization=org.id) .search(query={'search': hostname})[0] .read_json() ) self.assertEqual(result['subscription_status_label'], 'Fully entitled') # Verify the virt-who config-file exists. config_file = get_configure_file(vhd.id) get_configure_option('hypervisor_id', config_file), # Update virt-who config modify_name = gen_string('alpha') vhd.name = modify_name vhd.update(['name']) # Delete virt-who config vhd.delete() self.assertFalse( entities.VirtWhoConfig(organization_id=org.id).search( query={'search': 'name={}'.format(modify_name)} ) )
def test_positive_hypervisor_id_option(self, default_org, session, form_data): """Verify Hypervisor ID dropdown options. :id: 09826cc0-aa49-4355-8980-8097511eb7d7 :expectedresults: hypervisor_id can be changed in virt-who-config-{}.conf if the dropdown option is selected to uuid/hwuuid/hostname. :CaseLevel: Integration :CaseImportance: Medium """ name = gen_string('alpha') form_data['name'] = name with session: session.virtwho_configure.create(form_data) config_id = get_configure_id(name) config_command = get_configure_command(config_id, default_org.name) config_file = get_configure_file(config_id) values = ['uuid', 'hostname'] for value in values: session.virtwho_configure.edit(name, {'hypervisor_id': value}) results = session.virtwho_configure.read(name) assert results['overview']['hypervisor_id'] == value deploy_configure_by_command( config_command, form_data['hypervisor_type'], org=default_org.label ) assert get_configure_option('hypervisor_id', config_file) == value session.virtwho_configure.delete(name) assert not session.virtwho_configure.search(name)
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """ Verify hypervisor_id option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: f232547f-c4b2-41bc-ab8d-e7579a49ab69 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ # esx and rhevm support hwuuid option values = ['uuid', 'hostname', 'hwuuid'] for value in values: virtwho_config.hypervisor_id = value virtwho_config.update(['hypervisor_id']) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id) deploy_configure_by_command(command, form_data['hypervisor_type']) assert get_configure_option('hypervisor_id', config_file) == value virtwho_config.delete() assert not entities.VirtWhoConfig().search( query={'search': f"name={form_data['name']}"})
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """Verify hypervisor_id option by hammer virt-who-config update" :id: d8428508-3149-4558-8173-4386db5e3760 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ # esx and rhevm support hwuuid option values = ['uuid', 'hostname', 'hwuuid'] for value in values: VirtWhoConfig.update({ 'id': virtwho_config['id'], 'hypervisor-id': value }) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['hypervisor-id'] == value config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id']) deploy_configure_by_command(command, form_data['hypervisor-type']) assert get_configure_option('hypervisor_id', config_file) == value VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_hypervisor_id_option(self, session, form_data): """Verify Hypervisor ID dropdown options. :id: cc494bd9-51d9-452a-bfa9-5cdcafef5197 :expectedresults: hypervisor_id can be changed in virt-who-config-{}.conf if the dropdown option is selected to uuid/hwuuid/hostname. :CaseLevel: Integration :CaseImportance: Medium """ name = gen_string('alpha') form_data['name'] = name with session: session.virtwho_configure.create(form_data) config_id = get_configure_id(name) config_command = get_configure_command(config_id) config_file = get_configure_file(config_id) # esx and rhevm support hwuuid option values = ['uuid', 'hostname', 'hwuuid'] for value in values: session.virtwho_configure.edit(name, {'hypervisor_id': value}) results = session.virtwho_configure.read(name) assert results['overview']['hypervisor_id'] == value deploy_configure_by_command(config_command, form_data['hypervisor_type']) assert get_configure_option('hypervisor_id', config_file) == value session.virtwho_configure.delete(name) assert not session.virtwho_configure.search(name)
def test_positive_hypervisor_id_option(self, default_org, form_data, virtwho_config): """Verify hypervisor_id option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: 37a08451-2add-4c5c-bab6-ebe002a746f1 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] for value in values: virtwho_config.hypervisor_id = value virtwho_config.update(['hypervisor_id']) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id, default_org.name) deploy_configure_by_command( command, form_data['hypervisor_type'], org=default_org.label ) assert get_configure_option('hypervisor_id', config_file) == value virtwho_config.delete() assert not entities.VirtWhoConfig().search(query={'search': f"name={form_data['name']}"})
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """Verify hypervisor_id option by hammer virt-who-config update" :id: 551cfc6c-71cd-40e7-9997-a7c85db02c1f :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] for value in values: VirtWhoConfig.update({ 'id': virtwho_config['id'], 'hypervisor-id': value }) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['hypervisor-id'] == value config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id']) deploy_configure_by_command(command, form_data['hypervisor-type']) assert get_configure_option('hypervisor_id', config_file) == value VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_rhsm_option(self, default_org, form_data, virtwho_config, default_sat): """Verify rhsm options in the configure file" :id: b5b93d4d-e780-41c0-9eaa-2407cc1dcc9b :expectedresults: rhsm_hostname, rhsm_prefix are ecpected rhsm_username is not a login account :CaseLevel: Integration :CaseImportance: Medium """ config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id'], default_org.name) deploy_configure_by_command(command, form_data['hypervisor-type'], org=default_org.label) rhsm_username = get_configure_option('rhsm_username', config_file) assert not User.exists(search=('login', rhsm_username)) assert get_configure_option('rhsm_hostname', config_file) == default_sat.hostname assert get_configure_option('rhsm_prefix', config_file) == '/rhsm' VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_filtering_option(self, default_org, session, form_data): """Verify Filtering dropdown options. :id: e17dda14-79cd-4cd2-8f29-60970b24a905 :expectedresults: 1. if filtering is selected to Whitelist, 'Filter hosts' can be set. 2. if filtering is selected to Blacklist, 'Exclude hosts' can be set. :CaseLevel: Integration :CaseImportance: Medium :BZ: 1735670 """ name = gen_string('alpha') form_data['name'] = name with session: session.virtwho_configure.create(form_data) config_id = get_configure_id(name) config_command = get_configure_command(config_id, default_org.label) config_file = get_configure_file(config_id) regex = '.*redhat.com' whitelist = { 'filtering': 'Whitelist', 'filtering_content.filter_hosts': regex } blacklist = { 'filtering': 'Blacklist', 'filtering_content.exclude_hosts': regex } # esx support filter-host-parents and exclude-host-parents options whitelist['filtering_content.filter_host_parents'] = regex blacklist['filtering_content.exclude_host_parents'] = regex # Update Whitelist and check the result session.virtwho_configure.edit(name, whitelist) results = session.virtwho_configure.read(name) assert results['overview']['filter_hosts'] == regex assert results['overview']['filter_host_parents'] == regex deploy_configure_by_command(config_command, form_data['hypervisor_type'], org=default_org.label) assert regex == get_configure_option('filter_hosts', config_file) assert regex == get_configure_option('filter_host_parents', config_file) # Update Blacklist and check the result session.virtwho_configure.edit(name, blacklist) results = session.virtwho_configure.read(name) assert results['overview']['exclude_hosts'] == regex assert results['overview']['exclude_host_parents'] == regex deploy_configure_by_command(config_command, form_data['hypervisor_type'], org=default_org.label) assert regex == get_configure_option('exclude_hosts', config_file) assert regex == get_configure_option('exclude_host_parents', config_file) session.virtwho_configure.delete(name) assert not session.virtwho_configure.search(name)
def test_positive_virtwho_viewer_role(self, session, test_name, form_data): """Verify the virt-who viewer role can TRULY work. :id: bf3be2e4-3853-41cc-9b3e-c8677f0b8c5f :expectedresults: Virt-who Viewer Role granting permissions to see all configurations including their configuration scripts, which means viewers could still deploy the virt-who instances for existing virt-who configurations. """ username = gen_string('alpha') password = gen_string('alpha') config_name = gen_string('alpha') with session: # Create an user session.user.create({ 'user.login': username, 'user.mail': valid_emails_list()[0], 'user.auth': 'INTERNAL', 'user.password': password, 'user.confirm': password, }) # Create a virt-who config plugin form_data['name'] = config_name session.virtwho_configure.create(form_data) values = session.virtwho_configure.read(config_name) command = values['deploy']['command'] deploy_configure_by_command(command, form_data['hypervisor_type']) assert session.virtwho_configure.search( config_name)[0]['Status'] == 'ok' # Check the permissioin of Virt-who Viewer session.user.update( username, {'roles.resources.assigned': ['Virt-who Viewer']}) user = session.user.read(username) assert user['roles']['resources']['assigned'] == [ 'Virt-who Viewer' ] # Update the virt-who config file config_id = get_configure_id(config_name) config_file = get_configure_file(config_id) update_configure_option('rhsm_username', username, config_file) delete_configure_option('rhsm_encrypted_password', config_file) add_configure_option('rhsm_password', password, config_file) restart_virtwho_service() assert get_virtwho_status() == 'logerror' with Session(test_name, username, password) as newsession: create_permission = newsession.virtwho_configure.check_create_permission( ) update_permission = newsession.virtwho_configure.check_update_permission( config_name) assert create_permission['can_view'] assert not create_permission['can_create'] assert not update_permission['can_delete'] assert not update_permission['can_edit'] newsession.virtwho_configure.read(config_name) # Delete the created user session.user.delete(username) assert not session.user.search(username)
def test_positive_virtwho_reporter_role(self, default_org, session, test_name, form_data): """Verify the virt-who reporter role can TRULY work. :id: cd235ab0-d89c-464b-98d6-9d090ac40d8f :expectedresults: Virt-who Reporter Role granting minimal set of permissions for virt-who to upload the report, it can be used if you configure virt-who manually and want to use user that has locked down account. """ username = gen_string('alpha') password = gen_string('alpha') config_name = gen_string('alpha') with session: # Create an user session.user.create({ 'user.login': username, 'user.mail': valid_emails_list()[0], 'user.auth': 'INTERNAL', 'user.password': password, 'user.confirm': password, }) # Create a virt-who config plugin form_data['name'] = config_name session.virtwho_configure.create(form_data) values = session.virtwho_configure.read(config_name) command = values['deploy']['command'] deploy_configure_by_command(command, form_data['hypervisor_type'], org=default_org.label) assert session.virtwho_configure.search( config_name)[0]['Status'] == 'ok' # Update the virt-who config file config_id = get_configure_id(config_name) config_file = get_configure_file(config_id) update_configure_option('rhsm_username', username, config_file) delete_configure_option('rhsm_encrypted_password', config_file) add_configure_option('rhsm_password', password, config_file) restart_virtwho_service() assert get_virtwho_status() == 'logerror' # Check the permissioin of Virt-who Reporter session.user.update( username, {'roles.resources.assigned': ['Virt-who Reporter']}) assert session.user.search(username)[0]['Username'] == username user = session.user.read(username) assert user['roles']['resources']['assigned'] == [ 'Virt-who Reporter' ] restart_virtwho_service() assert get_virtwho_status() == 'running' with Session(test_name, username, password) as newsession: assert not newsession.virtwho_configure.check_create_permission( )['can_view'] session.user.delete(username) assert not session.user.search(username)
def test_positive_filter_option(self, default_org, form_data, virtwho_config): """Verify filter option by hammer virt-who-config update" :id: aaf45c5e-9504-47ce-8f25-b8073c2de036 :expectedresults: filter and filter_hosts can be updated. :CaseLevel: Integration :CaseImportance: Medium """ regex = '.*redhat.com' whitelist = { 'id': virtwho_config['id'], 'filtering-mode': 'whitelist', 'whitelist': regex } blacklist = { 'id': virtwho_config['id'], 'filtering-mode': 'blacklist', 'blacklist': regex } # esx support filter-host-parents and exclude-host-parents options whitelist['filter-host-parents'] = regex blacklist['exclude-host-parents'] = regex config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id'], default_org.name) # Update Whitelist and check the result VirtWhoConfig.update(whitelist) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['filtering'] == 'Whitelist' assert result['connection']['filtered-hosts'] == regex assert result['connection']['filter-host-parents'] == regex deploy_configure_by_command(command, form_data['hypervisor-type'], org=default_org.label) assert get_configure_option('filter_hosts', config_file) == regex assert get_configure_option('filter_host_parents', config_file) == regex # Update Blacklist and check the result VirtWhoConfig.update(blacklist) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['filtering'] == 'Blacklist' assert result['connection']['excluded-hosts'] == regex assert result['connection']['exclude-host-parents'] == regex deploy_configure_by_command(command, form_data['hypervisor-type'], org=default_org.label) assert get_configure_option('exclude_hosts', config_file) == regex assert get_configure_option('exclude_host_parents', config_file) == regex VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_filter_option(self, form_data, virtwho_config): """ Verify filter option by hammer virt-who-config update" :id: f46e4aa8-c325-4281-8744-f85e819e68c1 :expectedresults: filter and filter_hosts can be updated. :CaseLevel: Integration :CaseImportance: Medium """ regex = '.*redhat.com' whitelist = {'id': virtwho_config['id'], 'filtering-mode': 'whitelist', 'whitelist': regex} blacklist = {'id': virtwho_config['id'], 'filtering-mode': 'blacklist', 'blacklist': regex} if settings.virtwho.hypervisor_type == 'esx': whitelist['filter-host-parents'] = regex blacklist['exclude-host-parents'] = regex config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id']) # Update Whitelist and check the result VirtWhoConfig.update(whitelist) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['filtering'] == 'Whitelist' assert result['connection']['filtered-hosts'] == regex if settings.virtwho.hypervisor_type == 'esx': assert result['connection']['filter-host-parents'] == regex deploy_configure_by_command(command) assert get_configure_option('filter_hosts', config_file) == regex if settings.virtwho.hypervisor_type == 'esx': assert get_configure_option('filter_host_parents', config_file) == regex # Update Blacklist and check the result VirtWhoConfig.update(blacklist) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['filtering'] == 'Blacklist' assert result['connection']['excluded-hosts'] == regex if settings.virtwho.hypervisor_type == 'esx': assert result['connection']['exclude-host-parents'] == regex deploy_configure_by_command(command) assert get_configure_option('exclude_hosts', config_file) == regex if settings.virtwho.hypervisor_type == 'esx': assert get_configure_option('exclude_host_parents', config_file) == regex VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_rhsm_option(self, form_data, virtwho_config): """ Verify rhsm options in the configure file" :id: 5155d145-0a8d-4443-81d3-6fb7cef0533b :expectedresults: rhsm_hostname, rhsm_prefix are ecpected rhsm_username is not a login account :CaseLevel: Integration :CaseImportance: Medium """ config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id']) deploy_configure_by_command(command) rhsm_username = get_configure_option('rhsm_username', config_file) assert not User.exists(search=('login', rhsm_username)) assert get_configure_option('rhsm_hostname', config_file) == settings.server.hostname assert get_configure_option('rhsm_prefix', config_file) == '/rhsm' VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """Verify hypervisor_id option by "PUT /foreman_virt_who_configure/api/v2/configs/:id" :id: 16344235-1607-4f60-950b-5a91546cf8f4 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] for value in values: virtwho_config.hypervisor_id = value virtwho_config.update(['hypervisor_id']) config_file = get_configure_file(virtwho_config.id) command = get_configure_command(virtwho_config.id) deploy_configure_by_command(command, form_data['hypervisor_type']) assert get_configure_option('hypervisor_id', config_file) == value virtwho_config.delete() assert not entities.VirtWhoConfig().search(query={'search': f"name={form_data['name']}"})
def test_positive_hypervisor_id_option(self, form_data, virtwho_config): """ Verify hypervisor_id option by hammer virt-who-config update" :id: eae7e767-8a71-424c-87da-475c91ac2ea1 :expectedresults: hypervisor_id option can be updated. :CaseLevel: Integration :CaseImportance: Medium """ values = ['uuid', 'hostname'] if settings.virtwho.hypervisor_type in ('esx', 'rhevm'): values.append('hwuuid') for value in values: VirtWhoConfig.update({'id': virtwho_config['id'], 'hypervisor-id': value}) result = VirtWhoConfig.info({'id': virtwho_config['id']}) assert result['connection']['hypervisor-id'] == value config_file = get_configure_file(virtwho_config['id']) command = get_configure_command(virtwho_config['id']) deploy_configure_by_command(command) assert get_configure_option('hypervisor_id', config_file) == value VirtWhoConfig.delete({'name': virtwho_config['name']}) assert not VirtWhoConfig.exists(search=('name', form_data['name']))