コード例 #1
0
def test_crontab_end_before_begin():
    crontab = [
        '# End backdrop.collector jobs for my-app', 'foobar',
        '# Begin backdrop.collector jobs for my-app', 'other'
    ]
    new_crontab = remove_existing_crontab_for_app(crontab, 'my-app')
    assert_that(new_crontab, has_item(contains_string('foobar')))
    assert_that(new_crontab, is_not(has_item(contains_string('other'))))
コード例 #2
0
def test_crontab_begin_with_no_end():
    crontab = [
        'foobar',
        '# Begin backdrop.collector jobs for my-app',
        'other',
    ]
    new_crontab = remove_existing_crontab_for_app(crontab, 'my-app')
    assert_that(new_crontab,
                has_item(contains_string('foobar')))
    assert_that(new_crontab,
                is_not(has_item(contains_string('other'))))
コード例 #3
0
def test_jobs_are_not_removed_for_other_apps():
    crontab = [
        '# Begin backdrop.collector jobs for my-app',
        'foobar',
        '# End backdrop.collector jobs for my-app',
        '# Begin backdrop.collector jobs for other-app',
        'barfoo',
        '# End backdrop.collector jobs for other-app',
    ]
    new_crontab = remove_existing_crontab_for_app(crontab, 'my-app')
    assert_that(new_crontab, has_item(contains_string('barfoo')))
    assert_that(new_crontab, is_not(has_item(contains_string('foobar'))))
コード例 #4
0
def test_jobs_are_not_removed_for_other_apps():
    crontab = [
        '# Begin backdrop.collector jobs for my-app',
        'foobar',
        '# End backdrop.collector jobs for my-app',
        '# Begin backdrop.collector jobs for other-app',
        'barfoo',
        '# End backdrop.collector jobs for other-app',
    ]
    new_crontab = remove_existing_crontab_for_app(crontab, 'my-app')
    assert_that(new_crontab,
                has_item(contains_string('barfoo')))
    assert_that(new_crontab,
                is_not(has_item(contains_string('foobar'))))