Exemple #1
0
    def test_celery_health_check_command_raises_error_if_queue_exceeds_max_tasks_count_limit(
            self, task_log):
        max_tasks_count = 0

        with assert_raises(CommandError):
            call_command('celery_health_check',
                         max_tasks_count=max_tasks_count)
Exemple #2
0
    def test_celery_health_check_command_does_raise_error_if_queue_is_not_within_max_created_at_diff_limit(
            self, task_log):
        max_created_at_diff = 1

        with assert_raises(CommandError):
            call_command('celery_health_check',
                         max_created_at_diff=max_created_at_diff)
Exemple #3
0
 def test_excluded_command_should_not_be_logged(self):
     assert_equal(CommandLog.objects.count(), 0)
     call_command('showmigrations',
                  stdout=io.StringIO(),
                  stderr=io.StringIO())
     assert_equal(CommandLog.objects.count(), 0)
Exemple #4
0
 def test_celery_health_check_command_raises_command_error_for_max_created_at_diff_lower_than_zero(
         self):
     with assert_raises(CommandError):
         call_command('celery_health_check', max_created_at_diff=-1)
Exemple #5
0
 def test_celery_health_check_command_raises_command_error_for_max_tasks_count_lower_than_zero(
         self):
     with assert_raises(CommandError):
         call_command('celery_health_check', max_tasks_count=-1)
Exemple #6
0
 def test_celery_health_check_command_does_not_raise_error_if_queue_is_within_max_tasks_count_limit(
         self, task_log):
     with assert_not_raises(CommandError):
         call_command('celery_health_check', max_tasks_count=1)
Exemple #7
0
def test_call_command(*args, **kwargs):
    call_command(*args, **kwargs, stdout=io.StringIO(), stderr=io.StringIO())
 def test_excluded_command_should_not_be_logged(self):
     assert_equal(CommandLog.objects.count(), 0)
     call_command('showmigrations', stdout=io.StringIO(), stderr=io.StringIO())
     assert_equal(CommandLog.objects.count(), 0)