def test_remove_single_simple_job(): crontab = Crontab() crontab.crontab_lines = ['*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % { 'exe': sys.executable, 'manage': settings.CRONTAB_DJANGO_MANAGE_PATH }] crontab.remove_jobs() assert_equal([], crontab.crontab_lines)
def test_remove_many_different_jobs(): crontab = Crontab() ctx = dict(exe=sys.executable, manage=settings.CRONTAB_DJANGO_MANAGE_PATH) crontab.crontab_lines = [ '*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % ctx, '* 3 * * * %(exe)s %(manage)s crontab run c03a5151588fde26da760240ed6a9b9a > /home/myhome/logs/cron_job.log # django-cronjobs for tests\n' % ctx, '0 4 * * * %(exe)s %(manage)s crontab run e5b6fc0d28edb93283faf23e808b1065 # django-cronjobs for tests\n' % ctx, ] crontab.remove_jobs() assert_equal([], crontab.crontab_lines)
def test_remove_single_simple_job(): crontab = Crontab() crontab.crontab_lines = [ '*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % { 'exe': sys.executable, 'manage': settings.CRONTAB_DJANGO_MANAGE_PATH } ] crontab.remove_jobs() assert_equal([], crontab.crontab_lines)
def test_remove_job_but_keep_anything_else(): crontab = Crontab() ctx = dict(exe=sys.executable, manage=settings.CRONTAB_DJANGO_MANAGE_PATH) crontab.crontab_lines = [ '[email protected]', '*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % ctx, '* * * * * /some/other/job that --has=nothing > /to/do.with # us' ] crontab.remove_jobs() assert_equal([ '[email protected]', '* * * * * /some/other/job that --has=nothing > /to/do.with # us' ], crontab.crontab_lines)
def test_remove_many_different_jobs(): crontab = Crontab() ctx = dict(exe=sys.executable, manage=settings.CRONTAB_DJANGO_MANAGE_PATH) crontab.crontab_lines = [ '*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % ctx, '* 3 * * * %(exe)s %(manage)s crontab run c03a5151588fde26da760240ed6a9b9a > /home/myhome/logs/cron_job.log # django-cronjobs for tests\n' % ctx, '0 4 * * * %(exe)s %(manage)s crontab run e5b6fc0d28edb93283faf23e808b1065 # django-cronjobs for tests\n' % ctx, ] crontab.remove_jobs() assert_equal([], crontab.crontab_lines)
def test_remove_job_but_keep_anything_else(): crontab = Crontab() ctx = dict(exe=sys.executable, manage=settings.CRONTAB_DJANGO_MANAGE_PATH) crontab.crontab_lines = [ '[email protected]', '*/5 * * * * %(exe)s %(manage)s crontab run eb868be6b69c31faa6b03a4cf0dd3d8c # django-cronjobs for tests\n' % ctx, '* * * * * /some/other/job that --has=nothing > /to/do.with # us' ] crontab.remove_jobs() assert_equal([ '[email protected]', '* * * * * /some/other/job that --has=nothing > /to/do.with # us' ], crontab.crontab_lines)