def test_manageiq_ansible_add_provider(ansible_providers, provider): """This test checks adding a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'add_provider.yaml script runs against the appliance and adds a new provider 2. Test navigates to Containers Providers page and verifies the provider was added """ setup_ansible_script(provider, script_type='providers', script='add_provider') run_ansible('add_provider') assert get_yml_value('add_provider', 'name') in provider.summary.properties.name.value
def test_remove_tags(ansible_tags, provider): """This test removes tags from the Containers Provider and verifies in GUI they were removed successfully """ setup_ansible_script(provider, script='remove_tags', values_to_update=tags_to_add, script_type='tags') run_ansible('remove_tags') gui_tags = str(get_smart_management(provider)) assert tags_after_deletion in gui_tags
def test_manageiq_ansible_remove_provider(ansible_providers, provider): """This test checks removing a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'remove_provider.yaml script runs against the appliance and removes the provider 2. Test navigates to Containers Providers page and verifies the provider was removed """ setup_ansible_script(provider, script_type='providers', script='remove_provider') run_ansible('remove_provider') navigate_to(ContainersProvider, 'All', use_resetter=True) assert sel.is_displayed_text('No Records Found.')
def test_manageiq_ansible_add_provider(ansible_providers, provider): """This test checks adding a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'add_provider.yaml script runs against the appliance and adds a new provider 2. Test navigates to Containers Providers page and verifies the provider was added """ script_name = 'add_provider' setup_ansible_script(provider, script_type='providers', script=script_name) run_ansible(script_name) view = navigate_to(ContainersProvider, 'All', use_resetter=True) assert get_yml_value(script_name, 'name') in view.entities.entity_names
def test_manageiq_ansible_update_provider(ansible_providers, provider): """This test checks updating a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'update_provider.yaml script runs against the appliance and updates the previously added provider 2. Test navigates to Containers Providers page and verifies the provider was updated """ setup_ansible_script(provider, script_type='providers', values_to_update=providers_values_to_update, script='update_provider') run_ansible('update_provider') assert get_yml_value('update_provider', 'provider_api_hostname') in \ provider.summary.properties.host_name.value
def test_add_tags(ansible_tags, provider): """This test adds tags to the Containers Provider and verifies in GUI they were added successfully """ setup_ansible_script(provider, script='add_tags', values_to_update=tags_to_add, script_type='tags') run_ansible('add_tags') gui_tags = [x.lower() for x in(get_smart_management(provider))] for tag_to_test in tags_to_test: full_string = '{}{} {}'.format(tag_to_test.values()[0], ":", tag_to_test.values()[1]) assert full_string in gui_tags
def test_manageiq_ansible_remove_non_existing_provider(ansible_providers, provider): """This test checks removing a non-existing Containers Provider using Ansible script via Manage IQ module Steps: 1. 'remove_provider.yaml script runs against the appliance and removes the provider 2. Test navigates to Containers Providers page and verifies no provider was removed """ # Add provider script is added to verify against it in the end setup_ansible_script(provider, script_type='providers', script='add_provider') setup_ansible_script(provider, script_type='providers', script='remove_non_existing_provider') run_ansible('remove_non_existing_provider') assert get_yml_value('add_provider', 'name') in provider.summary.properties.name.value
def test_add_tags(ansible_tags, provider): """This test adds tags to the Containers Provider and verifies in GUI they were added successfully """ setup_ansible_script(provider, script='add_tags', values_to_update=tags_to_add, script_type='tags') run_ansible('add_tags') gui_tags = [x.lower() for x in (get_smart_management(provider))] for tag_to_test in tags_to_test: full_string = '{}{} {}'.format(tag_to_test.values()[0], ":", tag_to_test.values()[1]) assert full_string in gui_tags
def test_manageiq_ansible_remove_custom_attributes(ansible_custom_attributes, provider): """This test checks removing Custom Attribute using Ansible script via Manage IQ module Steps: 1. 'remove_custom_attributes.yml script runs against the appliance and removes custom attributes 2. Test navigates to Providers page and verifies the Custom Attributes were removed under Providers menu """ setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('remove_custom_attributes') pytest.sel.refresh() assert not sel.is_displayed_text('Custom Attributes')
def test_manageiq_ansible_edit_custom_attributes(ansible_custom_attributes, provider): """This test checks editing a Custom Attribute using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes.yml script runs against the appliance and edits custom attributes 2. Test navigates to Providers page and verifies the Custom Attributes were edited under Providers menu """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('add_custom_attributes') for custom_attribute in custom_attributes_to_edit: assert provider.get_detail('Custom Attributes', custom_attribute['name']) == custom_attribute['value']
def test_manageiq_ansible_remove_non_existing_provider(ansible_providers, provider): """This test checks removing a non-existing Containers Provider using Ansible script via Manage IQ module Steps: 1. 'remove_provider.yaml script runs against the appliance and removes the provider 2. Test navigates to Containers Providers page and verifies no provider was removed """ # Add provider script is added to verify against it in the end script_name = 'remove_non_existing_provider' setup_ansible_script(provider, script_type='providers', script='add_provider') setup_ansible_script(provider, script_type='providers', script=script_name) run_ansible(script_name) view = navigate_to(ContainersProvider, 'All', use_resetter=True) assert get_yml_value('add_provider', 'name') in view.entities.entity_names
def test_manageiq_ansible_edit_custom_attributes(ansible_custom_attributes, provider): """This test checks editing a Custom Attribute using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes.yml script runs against the appliance and edits custom attributes 2. Test navigates to Providers page and verifies the Custom Attributes were edited under Providers menu """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('add_custom_attributes') for custom_attribute in custom_attributes_to_edit: assert provider.get_detail( 'Custom Attributes', custom_attribute['name']) == custom_attribute['value']
def test_manageiq_ansible_remove_provider(ansible_providers, provider, soft_assert): """This test checks removing a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'remove_provider.yaml script runs against the appliance and removes the provider 2. Test navigates to Containers Providers page and verifies the provider was removed """ script_name = 'remove_provider' setup_ansible_script(provider, script_type='providers', script=script_name) run_ansible(script_name) view = navigate_to(ContainersProvider, 'All', use_resetter=True) soft_assert( wait_for(lambda: not get_yml_value(script_name, 'name') in view. entities.entity_names, num_sec=180, delay=10, fail_func=view.browser.refresh, message='Provider was not deleted successfully', silent_failure=True))
def test_manageiq_ansible_update_provider(ansible_providers, provider, soft_assert): """This test checks updating a Containers Provider using Ansible script via Manage IQ module Steps: 1. 'update_provider.yaml script runs against the appliance and updates the previously added provider 2. Test navigates to Containers Providers page and verifies the provider was updated """ script_name = 'update_provider' setup_ansible_script(provider, script_type='providers', values_to_update=providers_values_to_update, script=script_name) run_ansible(script_name) soft_assert( wait_for(lambda: get_yml_value(script_name, 'provider_api_hostname') in provider.summary.properties.host_name.text_value, num_sec=180, delay=10, fail_func=provider.browser.refresh, message='Provider was not updated successfully', silent_failure=True))
def test_manageiq_ansible_add_provider_incorrect_user(ansible_providers, provider): """This test checks adding a Containers Provider with a wrong user using Ansible script via Manage IQ module Steps: 1. 'add_provider_bad_user.yaml script runs against the appliance and tries to add a new provider with a wrong user. 2. Test navigates to Containers Providers page and verifies the provider was not added. """ setup_ansible_script(provider, script_type='providers', script='add_provider_bad_user') run_status = run_ansible('add_provider_bad_user') assert 'Authentication failed' in run_status navigate_to(ContainersProvider, 'All', use_resetter=True) assert sel.is_displayed_text('No Records Found.')
def test_manageiq_ansible_add_provider_incorrect_user(ansible_providers, provider, soft_assert): """This test checks adding a Containers Provider with a wrong user using Ansible script via Manage IQ module Steps: 1. 'add_provider_bad_user.yaml script runs against the appliance and tries to add a new provider with a wrong user. 2. Test navigates to Containers Providers page and verifies the provider was not added. """ script_name = 'add_provider_bad_user' setup_ansible_script(provider, script_type='providers', script=script_name) run_status = run_ansible(script_name) assert 'Authentication failed' in run_status view = navigate_to(ContainersProvider, 'All', use_resetter=True) assert not get_yml_value(script_name, 'name') in view.entities.entity_names
def test_manageiq_ansible_update_provider_incorrect_user(ansible_providers, provider): """This test checks updating a Containers Provider with a wrong user using Ansible script via Manage IQ module Steps: 1. 'add_provider_bad_user.yaml script runs against the appliance and tries to add a new provider with a wrong user. 2. Test navigates to Containers Providers page and verifies the provider was not updated. """ # Add provider script is added to verify against it in the end setup_ansible_script(provider, script_type='providers', script='add_provider') setup_ansible_script(provider, script_type='providers', values_to_update=providers_values_to_update, script='update_provider_bad_user') run_status = run_ansible('update_provider_bad_user') assert 'Authentication failed' in run_status assert get_yml_value('add_provider', 'name') in provider.summary.properties.name.value
def test_manageiq_ansible_add_custom_attributes_bad_user(ansible_custom_attributes, provider): """This test checks adding a Custom Attribute with a bad user name using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes_bad_user.yml script runs against the appliance and tries to add custom attributes. 2. Verify error message with Ansible reply 3. Test navigates to Providers page and verifies the Custom Attributes weren't added under Providers menu """ setup_ansible_script(provider, script='add_custom_attributes_bad_user', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_result = run_ansible('add_custom_attributes_bad_user') assert 'Authentication failed' in run_result for custom_attribute in custom_attributes_to_edit: assert provider.get_detail('Custom Attributes', custom_attribute['name']) == custom_attribute['value']
def test_manageiq_ansible_add_custom_attributes_bad_user( ansible_custom_attributes, provider): """This test checks adding a Custom Attribute with a bad user name using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes_bad_user.yml script runs against the appliance and tries to add custom attributes. 2. Verify error message with Ansible reply 3. Test navigates to Providers page and verifies the Custom Attributes weren't added under Providers menu """ setup_ansible_script(provider, script='add_custom_attributes_bad_user', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_result = run_ansible('add_custom_attributes_bad_user') assert 'Authentication failed' in run_result for custom_attribute in custom_attributes_to_edit: assert provider.get_detail( 'Custom Attributes', custom_attribute['name']) == custom_attribute['value']
def test_manageiq_ansible_update_provider_incorrect_user( ansible_providers, provider): """This test checks updating a Containers Provider with a wrong user using Ansible script via Manage IQ module Steps: 1. 'add_provider_bad_user.yaml script runs against the appliance and tries to add a new provider with a wrong user. 2. Test navigates to Containers Providers page and verifies the provider was not updated. """ # Add provider script is added to verify against it in the end setup_ansible_script(provider, script_type='providers', script='add_provider') setup_ansible_script(provider, script_type='providers', values_to_update=providers_values_to_update, script='update_provider_bad_user') run_status = run_ansible('update_provider_bad_user') assert 'Authentication failed' in run_status assert get_yml_value('add_provider', 'name') in provider.summary.properties.name.value
def clean_tags(provider): setup_ansible_script(provider, script='remove_tags', values_to_update=tags_to_add, script_type='tags') run_ansible('remove_tags')
def run_ansible_script(script, reload=True): run_status = run_ansible(script) if reload: pytest.sel.refresh() navigate_to(User, 'All') return run_status