예제 #1
0
    def test_completed_task_count(self, restore_mock):
        restore_mock.return_value.completed_count.return_value = 42
        rule = ScannerQueryRule(state=RUNNING, celery_group_result_id=str(uuid.uuid4()))
        assert rule._get_completed_tasks_count() == 42

        restore_mock.return_value = None
        assert rule._get_completed_tasks_count() is None
예제 #2
0
 def test_completed_task_count_no_group_id(self):
     rule = ScannerQueryRule(state=RUNNING, celery_group_result_id=None)
     assert rule._get_completed_tasks_count() is None