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 Polarion: assignee: juwatts caseimportance: medium initialEstimate: 1/6h """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('add_custom_attributes') verify_custom_attributes(provider, custom_attributes_to_edit) setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = refresh_and_navigate(provider, 'Details') assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_remove_custom_attributes(appliance, 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 Polarion: assignee: juwatts caseimportance: high casecomponent: Containers initialEstimate: 1/6h """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('add_custom_attributes') setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = navigate_to(provider, 'Details', force=True) assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_add_custom_attributes_same_name( ansible_custom_attributes, provider): """This test checks adding a Custom Attribute with the same name using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes_same_name.yml script runs against the appliance and adds same custom attributes that were already used 2. Test navigates to Providers page and verifies the Custom Attributes weren't added 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') run_ansible('add_custom_attributes') verify_custom_attributes(provider, custom_attributes_to_edit) setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = refresh_and_navigate(provider, 'Details') assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_add_custom_attributes_same_name( appliance, ansible_custom_attributes, provider): """This test checks adding a Custom Attribute with the same name using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes_same_name.yml script runs against the appliance and adds same custom attributes that were already used 2. Test navigates to Providers page and verifies the Custom Attributes weren't added under Providers menu Polarion: assignee: juwatts caseimportance: high casecomponent: Containers initialEstimate: 1/6h """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('add_custom_attributes') run_ansible('add_custom_attributes') verify_custom_attributes( appliance=appliance, provider=provider, custom_attributes_to_verify=custom_attributes_to_edit) setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_edit, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = navigate_to(provider, 'Details', force=True) assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_add_custom_attributes(appliance, ansible_custom_attributes, provider): """This test checks adding a Custom Attribute using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes.yml script runs against the appliance and adds custom attributes 2. Test navigates to Providers page and verifies the Custom Attributes were added under Providers menu Polarion: assignee: juwatts caseimportance: medium casecomponent: Containers initialEstimate: 1/6h """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('add_custom_attributes') verify_custom_attributes(appliance=appliance, provider=provider, custom_attributes_to_verify=custom_attributes_to_add) setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = navigate_to(provider, 'Details', force=True) assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_add_custom_attributes_bad_user(appliance, 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 Polarion: assignee: juwatts caseimportance: medium casecomponent: Containers initialEstimate: 1/6h """ 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 view = navigate_to(provider, 'Details', force=True) assert not view.entities.summary('Custom Attributes').is_displayed
def test_manageiq_ansible_add_custom_attributes_bad_user( appliance, 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 Polarion: assignee: juwatts caseimportance: high casecomponent: Containers initialEstimate: 1/6h """ 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 view = navigate_to(provider, 'Details', force=True) assert not view.entities.summary('Custom Attributes').is_displayed
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) def check(): view = refresh_and_navigate(provider, 'Details') return (get_yml_value(script_name, 'provider_api_hostname') in view.entities.properties.get_text_of('Host Name')) soft_assert( wait_for(check, num_sec=180, delay=10, message='Provider was not updated successfully', silent_failure=True))
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_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_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_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_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') verify_custom_attributes(provider, custom_attributes_to_edit)
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') view = navigate_to(provider, 'Details') assert not view.entities.custom_attributes.is_displayed
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_add_custom_attributes_same_name(ansible_custom_attributes, provider): """This test checks adding a Custom Attribute with the same name using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes_same_name.yml script runs against the appliance and adds same custom attributes that were already used 2. Test navigates to Providers page and verifies the Custom Attributes weren't added 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') verify_custom_attributes(provider, custom_attributes_to_edit)
def test_manageiq_ansible_create_same_name_user(ansible_users, provider): """This test checks updating a User using Ansible script via Manage IQ module Steps: 1. 'create_user.yml script runs against the appliance and adds a new user 2. Test navigates to Settings page and verifies the user was updated under Access Control """ setup_ansible_script(provider, script='create_user', values_to_update=users_values_to_create, script_type='users') run_ansible_script('create_user') view = navigate_to(User, 'All') names_list = [] for row in view.entities.table.rows(): name = row['username'].text names_list.append(name) assert users_values_to_create.get('name') in names_list
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_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 verify_custom_attributes(provider, custom_attributes_to_edit)
def test_manageiq_ansible_bad_user_name(ansible_users, provider): """This test checks updating a User using Ansible script with a bad username Steps: 1. 'create_user_bad_user_name.yml script runs against the appliance tries to add a new user 2. Test navigates to Settings page and verifies the user was not added under Access Control """ setup_ansible_script(provider, script='create_user_bad_user_name', values_to_update=users_values_to_create, script_type='users') run_status = run_ansible_script('create_user_bad_user_name') assert 'Authentication failed' in run_status view = navigate_to(User, 'All') names_list = [] for row in view.entities.table.rows(): name = row['username'].text names_list.append(name) assert users_values_to_create.get('name') in names_list
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_custom_attributes(ansible_custom_attributes, provider): """This test checks adding a Custom Attribute using Ansible script via Manage IQ module Steps: 1. 'add_custom_attributes.yml script runs against the appliance and adds custom attributes 2. Test navigates to Providers page and verifies the Custom Attributes were added under Providers menu """ setup_ansible_script(provider, script='add_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('add_custom_attributes') verify_custom_attributes(provider, custom_attributes_to_add) setup_ansible_script(provider, script='remove_custom_attributes', values_to_update=custom_attributes_to_add, script_type='custom_attributes') run_ansible('remove_custom_attributes') view = refresh_and_navigate(provider, 'Details') assert not view.entities.summary('Custom Attributes').is_displayed
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) def check(): view = refresh_and_navigate(provider, 'Details') return (get_yml_value(script_name, 'provider_api_hostname') in view.entities.properties.get_text_of('Host Name')) soft_assert( wait_for(check, num_sec=180, delay=10, message='Provider was not updated successfully', silent_failure=True) )
def clean_tags(provider): setup_ansible_script(provider, script='remove_tags', values_to_update=tags_to_add, script_type='tags') run_ansible('remove_tags')