Esempio n. 1
0
def test_make_prune_flags_returns_flags_from_config_plus_default_prefix():
    retention_config = OrderedDict(
        (('keep_daily', 1), ('keep_weekly', 2), ('keep_monthly', 3)))

    result = module._make_prune_flags(retention_config)

    assert tuple(result) == BASE_PRUNE_FLAGS + (('--prefix', '{hostname}-'), )
Esempio n. 2
0
def test_make_prune_flags_accepts_prefix_with_placeholders():
    retention_config = OrderedDict((('keep_daily', 1), ('prefix', 'Documents_{hostname}-{now}')))

    result = module._make_prune_flags(retention_config)

    expected = (('--keep-daily', '1'), ('--prefix', 'Documents_{hostname}-{now}'))

    assert tuple(result) == expected
Esempio n. 3
0
def test_make_prune_flags_treats_none_prefix_as_no_prefix():
    retention_config = OrderedDict((('keep_daily', 1), ('prefix', None)))

    result = module._make_prune_flags(retention_config)

    expected = (('--keep-daily', '1'), )

    assert tuple(result) == expected
Esempio n. 4
0
def test_make_prune_flags_accepts_prefix_with_placeholders():
    retention_config = OrderedDict((('keep_daily', 1), ('prefix', 'Documents_{hostname}-{now}')))

    result = module._make_prune_flags(retention_config)

    expected = (('--keep-daily', '1'), ('--prefix', 'Documents_{hostname}-{now}'))

    assert tuple(result) == expected
Esempio n. 5
0
def test_make_prune_flags_should_return_flags_from_config():
    retention_config = OrderedDict(
        (
            ('keep_daily', 1),
            ('keep_weekly', 2),
            ('keep_monthly', 3),
        )
    )

    result = module._make_prune_flags(retention_config)

    assert tuple(result) == BASE_PRUNE_FLAGS
Esempio n. 6
0
def test_make_prune_flags_should_return_flags_from_config_plus_default_prefix():
    retention_config = OrderedDict(
        (
            ('keep_daily', 1),
            ('keep_weekly', 2),
            ('keep_monthly', 3),
        )
    )

    result = module._make_prune_flags(retention_config)

    assert tuple(result) == BASE_PRUNE_FLAGS + (('--prefix', '{hostname}-'),)