Example #1
0
def test_split_fields_with_special_delimiter():
    """Unit test
    Given
    - split_fields method
    - the default delimiter is ;
    When
    - splitting values with a different delimiter - ','
    Then
    -  Validate the fields were created correctly
    """
    expected_dict_fields = {'a': 'b', 'c': 'd'}
    assert expected_dict_fields == split_fields('a=b,c=d', ',')

    expected_custom_field = {
        'u_customfield': "<a href=\'https://google.com\'>Link text<;/a>"
    }
    assert expected_custom_field == split_fields(
        "u_customfield=<a href=\'https://google.com\'>Link text<;/a>", ',')

    try:
        split_fields('a')
    except Exception as err:
        assert "must contain a '=' to specify the keys and values" in str(err)
        return
    assert False
Example #2
0
def test_split_fields():
    expected_dict_fields = {'a': 'b', 'c': 'd'}
    assert expected_dict_fields == split_fields('a=b;c=d')

    expected_custom_field = {
        'u_customfield': "<a href=\'https://google.com\'>Link text</a>"
    }
    assert expected_custom_field == split_fields(
        "u_customfield=<a href=\'https://google.com\'>Link text</a>")

    expected_custom_sys_params = {
        "sysparm_display_value": 'all',
        "sysparm_exclude_reference_link": 'True',
        "sysparm_query": 'number=TASK0000001'
    }

    assert expected_custom_sys_params == split_fields(
        "sysparm_display_value=all;sysparm_exclude_reference_link=True;sysparm_query=number=TASK0000001"
    )

    try:
        split_fields('a')
    except Exception as err:
        assert "must contain a '=' to specify the keys and values" in str(err)
        return
    assert False
Example #3
0
def test_split_fields():
    expected_dict_fields = {'a': 'b', 'c': 'd'}
    assert expected_dict_fields == split_fields('a=b;c=d')

    try:
        split_fields('a')
    except Exception as err:
        assert "must contain a '=' to specify the keys and values" in str(err)
        return
    assert False
Example #4
0
def test_split_fields():
    expected_dict_fields = {'a': 'b', 'c': 'd'}
    expected_dict_fields == split_fields('a=b;c=d')