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')
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
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)
Exemplo n.º 4
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()
Exemplo n.º 5
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))

    if hasattr(provider.summary, 'custom_attributes'):
        assert 'nondate' not in provider.summary.custom_attributes
Exemplo n.º 6
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
Exemplo n.º 7
0
def test_very_long_value_with_special_characters(request, provider):
    """
    Polarion:
        assignee: juwatts
        caseimportance: medium
        casecomponent: Containers
        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 = navigate_to(provider, 'Details', force=True)
    assert ca.value == view.entities.summary('Custom Attributes').get_text_of(ca.name)
Exemplo n.º 8
0
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!')

    if hasattr(provider.summary, 'custom_attributes'):
        assert "" not in provider.summary.custom_attributes
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
Exemplo n.º 10
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
        casecomponent: Containers
        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 = navigate_to(provider, 'Details', force=True)
    if view.entities.summary('Custom Attributes').is_displayed:
        assert 'nondate' not in view.entities.summary('Custom Attributes').fields
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

    Polarion:
        assignee: juwatts
        caseimportance: medium
        casecomponent: Containers
        initialEstimate: 1/6h
    """
    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 = navigate_to(provider, 'Details', force=True)
    if view.entities.summary('Custom Attributes').is_displayed:
        assert "" not in view.entities.summary('Custom Attributes').fields
Exemplo n.º 12
0
pytestmark = [
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2),
    pytest.mark.provider([ContainersProvider], scope='function')
]


def get_random_string(length):
    valid_chars = digits + ascii_letters + ' !@#$%^&*()'
    out = ''.join([choice(valid_chars) for _ in xrange(length)])
    return re.sub('\s+', ' ', out)


ATTRIBUTES_DATASET = [
    CustomAttribute('exp date', '2017-01-02', 'Date'),
    CustomAttribute('sales force acount', 'ADF231VRWQ1', None),
    CustomAttribute('expected num of nodes', '2', None)
]
VALUE_UPDATES = ['2018-07-12', 'ADF231VRWQ1', '1']


# TODO: Fixturize tests


@pytest.mark.polarion('CMP-10281')
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
Exemplo n.º 13
0
def test_very_long_value_with_special_characters(provider):
    ca = CustomAttribute('very_long_value', get_random_string(1000), None)
    provider.add_custom_attributes(ca)
    provider.summary.reload()
    assert ca.value == provider.summary.custom_attributes.very_long_value.value
    provider.delete_custom_attributes(ca)
Exemplo n.º 14
0
def test_very_long_name_with_special_characters(provider):
    ca = CustomAttribute(get_random_string(1000), 'very_long_name', None)
    provider.add_custom_attributes(ca)
    provider.summary.reload()
    assert ca.name in provider.summary.custom_attributes.raw_keys
    provider.delete_custom_attributes(ca)
Exemplo n.º 15
0
    pytest.mark.uncollectif(lambda: current_version() < "5.7"),
    pytest.mark.usefixtures('setup_provider'),
    pytest.mark.tier(2)
]
pytest_generate_tests = testgen.generate([ContainersProvider],
                                         scope='function')


def get_random_string(length):
    valid_chars = digits + ascii_letters + ' !@#$%^&*()'
    out = ''.join([choice(valid_chars) for _ in xrange(length)])
    return re.sub('\s+', ' ', out)


ATTRIBUTES_DATASET = [
    CustomAttribute('exp_date', '2017-01-02', 'Date'),
    CustomAttribute('sales_force_acount', 'ADF231VRWQ1', None),
    CustomAttribute('expected_num_of_nodes', '2', None)
]
VALUE_UPDATES = ['2018-07-12', 'ADF231VRWQ1', '1']


@pytest.mark.polarion('CMP-10281')
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
    """