def test_very_long_value_with_special_characters(provider):
    ca = CustomAttribute('very_long_value', get_random_string(1000), None)
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.value == view.entities.custom_attributes.read().get(
        'very_long_value')
    provider.delete_custom_attributes(ca)
def test_delete_static_custom_attributes(add_delete_custom_attributes, request, provider):
    """Tests deleting of static custom attributes from provider
    Steps:
        * Delete the static custom attributes that recently added (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully deleted
        (you should not see a custom attributes table)
    """

    provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.summary('Custom Attributes').is_displayed:
        for attr in ATTRIBUTES_DATASET:
            assert attr.name not in view.entities.summary('Custom Attributes').fields
    else:
        logger.info("No custom attributes table to check")
        assert True

    ca = CustomAttribute('test_value', 'This is a test', None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    provider.browser.refresh()
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in view.entities.summary('Custom Attributes').fields
        assert view.entities.summary('Custom Attributes').get_text_of(attr.name) == attr.value
    provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    provider.browser.refresh()
    if view.entities.summary('Custom Attributes').is_displayed:
        for attr in ATTRIBUTES_DATASET:
            assert attr.name not in view.entities.summary('Custom Attributes').fields
    else:
        logger.info("Custom Attributes Table does not exist. Expecting it to exist")
        assert False
示例#3
0
def test_edit_static_custom_attributes(provider):
    """Tests editing of static custom attributes from provider
    Prerequisite:
        * test_add_static_custom_attributes passed.
    Steps:
        * Edit (update) the static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully updated to the new values

    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """

    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    edited_attribs = deepcopy(ATTRIBUTES_DATASET)
    for ii, value in enumerate(VALUE_UPDATES):
        edited_attribs[ii].value = value
    provider.edit_custom_attributes(*edited_attribs)
    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.summary('Custom Attributes')
    for attr in edited_attribs:
        assert attr.name in custom_attr_ui.fields
        assert custom_attr_ui.get_text_of(attr.name) == attr.value
    provider.delete_custom_attributes(*edited_attribs)
def test_edit_static_custom_attributes(provider):
    """Tests editing of static custom attributes from provider
    Prerequisite:
        * test_add_static_custom_attributes passed.
    Steps:
        * Edit (update) the static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully updated to the new values

    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """

    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    edited_attribs = deepcopy(ATTRIBUTES_DATASET)
    for ii, value in enumerate(VALUE_UPDATES):
        edited_attribs[ii].value = value
    provider.edit_custom_attributes(*edited_attribs)
    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.summary('Custom Attributes')
    for attr in edited_attribs:
        assert attr.name in custom_attr_ui.fields
        assert custom_attr_ui.get_text_of(attr.name) == attr.value
    provider.delete_custom_attributes(*edited_attribs)
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_delete_static_custom_attributes(add_delete_custom_attributes, request, provider):
    """Tests deleting of static custom attributes from provider
    Steps:
        * Delete the static custom attributes that recently added (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully deleted
        (you should not see a custom attributes table)
    """

    provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.summary('Custom Attributes').is_displayed:
        for attr in ATTRIBUTES_DATASET:
            assert attr.name not in view.entities.summary('Custom Attributes').fields
    else:
        logger.info("No custom attributes table to check")
        assert True

    ca = CustomAttribute('test_value', 'This is a test', None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    provider.browser.refresh()
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in view.entities.summary('Custom Attributes').fields
        assert view.entities.summary('Custom Attributes').get_text_of(attr.name) == attr.value
    provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    provider.browser.refresh()
    if view.entities.summary('Custom Attributes').is_displayed:
        for attr in ATTRIBUTES_DATASET:
            assert attr.name not in view.entities.summary('Custom Attributes').fields
    else:
        logger.info("Custom Attributes Table does not exist. Expecting it to exist")
        assert False
示例#7
0
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_very_long_value_with_special_characters(request, provider):
    ca = CustomAttribute('very_long_value', get_random_string(1000), None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.value == view.entities.summary('Custom Attributes').get_text_of(
        'very_long_value')
示例#9
0
def check_labels_in_ui(instance, name, expected_value):
    view = refresh_and_navigate(instance, 'Details')
    if view.entities.labels.is_displayed:
        try:
            return view.entities.labels.get_text_of(name) == str(expected_value)
        except NameError:
            return False
    return False
def add_delete_custom_attributes(provider):
    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    assert view.entities.summary('Custom Attributes').is_displayed
    yield
    try:
        provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    except:
        logger.info("No custom attributes to delete")
def add_delete_custom_attributes(provider):
    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    assert view.entities.summary('Custom Attributes').is_displayed
    yield
    try:
        provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    except APIException:
        logger.info("No custom attributes to delete")
示例#12
0
def check_labels_in_ui(instance, name, expected_value):
    view = refresh_and_navigate(instance, 'Details')
    if view.entities.labels.is_displayed:
        try:
            return view.entities.labels.get_text_of(name) == str(
                expected_value)
        except NameError:
            return False
    return False
示例#13
0
def test_add_date_attr_with_wrong_value(provider):
    """Trying to add attribute of type date with non-date value"""
    ca = CustomAttribute('nondate', "koko", 'Date')
    with pytest.raises(APIException):
        provider.add_custom_attributes(ca)
        pytest.fail('You have added custom attribute of type'
                    '{} with value of {} and didn\'t get an error!'
                    .format(ca.field_type, ca.value))
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.custom_attributes.is_displayed:
        assert 'nondate' not in view.entities.custom_attributes.read()
def test_very_long_value_with_special_characters(request, provider):
    """
    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """
    ca = CustomAttribute('very long value', get_random_string(1000), None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.value == view.entities.summary('Custom Attributes').get_text_of(ca.name)
示例#15
0
def test_very_long_name_with_special_characters(request, provider):
    """
    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """
    ca = CustomAttribute(get_random_string(1000), 'very_long_name', None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.name in view.entities.summary('Custom Attributes').fields
def test_add_static_custom_attributes(add_delete_custom_attributes, provider):
    """Tests adding of static custom attributes to provider
    Steps:
        * Add static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully added
    """

    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.custom_attributes.read()
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in custom_attr_ui
        assert custom_attr_ui[attr.name] == attr.value
def test_add_static_custom_attributes(add_delete_custom_attributes, provider):
    """Tests adding of static custom attributes to provider
    Steps:
        * Add static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully added
    """

    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.summary('Custom Attributes')
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in custom_attr_ui.fields
        assert custom_attr_ui.get_text_of(attr.name) == attr.value
示例#18
0
def test_delete_static_custom_attributes(provider):
    """Tests deleting of static custom attributes from provider
    Steps:
        * Delete the static custom attributes that recently added (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully deleted
        (you should not see a custom attributes table)
    """

    provider.delete_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.custom_attributes.is_displayed:
        for attr in ATTRIBUTES_DATASET:
            assert attr.name not in view.entities.custom_attributes
示例#19
0
def test_add_static_custom_attributes(provider):
    """Tests adding of static custom attributes to provider
    Steps:
        * Add static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully added
    """

    provider.add_custom_attributes(*ATTRIBUTES_DATASET)
    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.custom_attributes.read()
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in custom_attr_ui
        assert custom_attr_ui[attr.name] == attr.value
def test_add_attribute_with_empty_name(provider):
    """Tests adding of static custom attributes with empty field
    Steps:
        * add the static custom attribute with name "" (API)
        * Go to provider summary page
    Expected results:
        * You should get an error
        * You should not see this attribute in the custom  attributes table
    """
    with pytest.raises(APIException):
        provider.add_custom_attributes(CustomAttribute('', "17"))
        pytest.fail('You have added custom attribute with empty name'
                    'and didn\'t get an error!')
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.summary('Custom Attributes').is_displayed:
        assert "" not in view.entities.summary('Custom Attributes').fields
def test_add_date_attr_with_wrong_value(provider):
    """Trying to add attribute of type date with non-date value

    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """
    ca = CustomAttribute('nondate', "koko", 'Date')
    with pytest.raises(APIException):
        provider.add_custom_attributes(ca)
        pytest.fail('You have added custom attribute of type'
                    '{} with value of {} and didn\'t get an error!'
                    .format(ca.field_type, ca.value))
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.summary('Custom Attributes').is_displayed:
        assert 'nondate' not in view.entities.summary('Custom Attributes').fields
示例#22
0
def test_add_date_attr_with_wrong_value(provider):
    """Trying to add attribute of type date with non-date value

    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """
    ca = CustomAttribute('nondate', "koko", 'Date')
    with pytest.raises(APIException):
        provider.add_custom_attributes(ca)
        pytest.fail('You have added custom attribute of type'
                    '{} with value of {} and didn\'t get an error!'.format(
                        ca.field_type, ca.value))
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.summary('Custom Attributes').is_displayed:
        assert 'nondate' not in view.entities.summary(
            'Custom Attributes').fields
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
    view = refresh_and_navigate(provider, 'Details')
    assert not view.entities.summary('Custom Attributes').is_displayed
def test_add_attribute_with_empty_name(provider):
    """Tests adding of static custom attributes with empty field
    Steps:
        * add the static custom attribute with name "" (API)
        * Go to provider summary page
    Expected results:
        * You should get an error
        * You should not see this attribute in the custom  attributes table
    """
    with pytest.raises(APIException):
        provider.add_custom_attributes(
            CustomAttribute('', "17")
        )
        pytest.fail('You have added custom attribute with empty name'
                    'and didn\'t get an error!')
    view = refresh_and_navigate(provider, 'Details')
    if view.entities.custom_attributes.is_displayed:
        assert "" not in view.entities.custom_attributes.read()
def test_add_static_custom_attributes(add_delete_custom_attributes, provider):
    """Tests adding of static custom attributes to provider
    Steps:
        * Add static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully added

    Polarion:
        assignee: juwatts
        caseimportance: medium
        initialEstimate: 1/6h
    """

    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.summary('Custom Attributes')
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in custom_attr_ui.fields
        assert custom_attr_ui.get_text_of(attr.name) == attr.value
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='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 = refresh_and_navigate(provider, 'Details')
    assert not view.entities.summary('Custom Attributes').is_displayed
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
    view = refresh_and_navigate(provider, 'Details')
    assert not view.entities.summary('Custom Attributes').is_displayed
示例#28
0
def test_edit_static_custom_attributes(provider):
    """Tests editing of static custom attributes from provider
    Prerequisite:
        * test_add_static_custom_attributes passed.
    Steps:
        * Edit (update) the static custom attributes (API)
        * Go to provider summary page
    Expected results:
        * The attributes was successfully updated to the new values
    """

    edited_attribs = ATTRIBUTES_DATASET
    for ii, value in enumerate(VALUE_UPDATES):
        edited_attribs[ii].value = value
    provider.edit_custom_attributes(*edited_attribs)
    view = refresh_and_navigate(provider, 'Details')
    custom_attr_ui = view.entities.custom_attributes.read()
    for attr in ATTRIBUTES_DATASET:
        assert attr.name in custom_attr_ui
        assert custom_attr_ui[attr.name] == attr.value
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='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 = refresh_and_navigate(provider, 'Details')
    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
示例#31
0
 def compliance_status(self):
     view = refresh_and_navigate(self, 'Details')
     return view.entities.compliance.read().get('Status').strip()
def test_very_long_value_with_special_characters(provider):
    ca = CustomAttribute('very_long_value', get_random_string(1000), None)
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.value == view.entities.custom_attributes.read().get('very_long_value')
    provider.delete_custom_attributes(ca)
 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'))
def get_table_attr(instance, table_name, attr):
    # Trying to read the table <table_name> attribute <attr>
    view = refresh_and_navigate(instance, 'Details')
    table = getattr(view.entities, table_name, None)
    if table:
        return table.read().get(attr)
 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'))
def get_table_attr(instance, table_name, attr):
    # Trying to read the table <table_name> attribute <attr>
    view = refresh_and_navigate(instance, 'Details')
    table = getattr(view.entities, table_name, None)
    if table:
        return table.read().get(attr)
示例#37
0
 def compliance_status(self):
     view = refresh_and_navigate(self, 'Details')
     return view.entities.compliance.read().get('Status').strip()
 def is_tag():
     view = refresh_and_navigate(obj_inst, 'Details')
     return view.entities.smart_management.read().get('My Company Tags', [])
示例#39
0
 def is_tag():
     view = refresh_and_navigate(obj_inst, 'Details')
     return view.entities.smart_management.read().get('My Company Tags', [])
def test_very_long_value_with_special_characters(request, provider):
    ca = CustomAttribute('very_long_value', get_random_string(1000), None)
    request.addfinalizer(lambda: provider.delete_custom_attributes(ca))
    provider.add_custom_attributes(ca)
    view = refresh_and_navigate(provider, 'Details')
    assert ca.value == view.entities.summary('Custom Attributes').get_text_of('very_long_value')