Пример #1
0
def test_get_substitution_from_config_finds_single_substitution():
    """
    Retrieve a single substitution from the config. Integration test--actually
    pulls from a file.
    """
    # This is hardcoded matching the value in the file.
    single_sub = substitute.Substitution('foo', 'bar', False)
    target = [single_sub]

    config_obj = _get_egrc_config(PATH_EGRC_SINGLE_SUB)

    actual = config.get_substitutions_from_config(config_obj)
    assert_equal(actual, target)
Пример #2
0
def test_get_substitution_from_config_finds_single_substitution():
    """
    Retrieve a single substitution from the config. Integration test--actually
    pulls from a file.
    """
    # This is hardcoded matching the value in the file.
    single_sub = substitute.Substitution('foo', 'bar', False)
    target = [single_sub]

    config_obj = _get_egrc_config(PATH_EGRC_SINGLE_SUB)

    actual = config.get_substitutions_from_config(config_obj)
    assert_equal(actual, target)
Пример #3
0
def test_get_substitution_from_config_finds_multiple_substitutions():
    """
    Retrieve multiple substitutions from a config in the appropriate order.
    Integration test--actually pulls from a file.
    """
    # These are hardcoded matching the value in the file. They will be sorted
    # alphabetically by pattern name.
    first_sub = substitute.Substitution(r'    ', r'', False)
    second_sub = substitute.Substitution('\n\n\n', '\n\n', True)
    target = [first_sub, second_sub]

    config_obj = _get_egrc_config(PATH_EGRC_WITH_DATA)

    actual = config.get_substitutions_from_config(config_obj)
    assert_equal(actual, target)
Пример #4
0
def test_get_substitution_from_config_finds_multiple_substitutions():
    """
    Retrieve multiple substitutions from a config in the appropriate order.
    Integration test--actually pulls from a file.
    """
    # These are hardcoded matching the value in the file. They will be sorted
    # alphabetically by pattern name.
    first_sub = substitute.Substitution(r'    ', r'', False)
    second_sub = substitute.Substitution('\n\n\n', '\n\n', True)
    target = [first_sub, second_sub]

    config_obj = _get_egrc_config(PATH_EGRC_WITH_DATA)

    actual = config.get_substitutions_from_config(config_obj)
    assert_equal(actual, target)