Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateusz Sikora
committed
Oct 20, 2014
1 parent
6d12461
commit 844cb51
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
from django.utils import unittest | ||
from django_cron.models import CronJobLog | ||
from django.core.management import call_command | ||
|
||
|
||
class SimpleTestCase(unittest.TestCase): | ||
class TestCase(unittest.TestCase): | ||
|
||
success_cron = 'test_crons.TestSucessCronJob' | ||
error_cron = 'test_crons.TestErrorCronJob' | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def test_example(self): | ||
"""Some test example""" | ||
pass | ||
def test_success_cron(self): | ||
lgos_count = CronJobLog.objects.all().count() | ||
call_command('runcrons', self.success_cron, force=True) | ||
self.assertEqual(CronJobLog.objects.all().count(), lgos_count + 1) | ||
|
||
def test_failed_cron(self): | ||
lgos_count = CronJobLog.objects.all().count() | ||
call_command('runcrons', self.error_cron, force=True) | ||
self.assertEqual(CronJobLog.objects.all().count(), lgos_count + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django_cron import CronJobBase, Schedule | ||
|
||
|
||
class TestSucessCronJob(CronJobBase): | ||
code = 'test_success_cron_job' | ||
schedule = Schedule(run_every_mins=0) | ||
|
||
def do(self): | ||
pass | ||
|
||
|
||
class TestErrorCronJob(CronJobBase): | ||
code = 'test_error_cron_job' | ||
schedule = Schedule(run_every_mins=0) | ||
|
||
def do(self): | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters