Skip to content

Commit

Permalink
Add support for SCANCODEIO_ASYNC in failing unit test #901
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Druez <[email protected]>
  • Loading branch information
tdruez committed Sep 1, 2023
1 parent 415aaad commit 3c3c5e4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scanpipe/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from unittest import mock

from django.conf import settings
from django.test import TestCase

from scanpipe import tasks
Expand Down Expand Up @@ -53,14 +54,17 @@ def test_scanpipe_tasks_execute_pipeline_run_next_on_success(self, mock_execute)
mock_execute.return_value = 0, ""
tasks.execute_pipeline_task(run.pk)
mock_execute.assert_called()
self.assertEqual(2, mock_execute.call_count)

run.refresh_from_db()
self.assertEqual(0, run.task_exitcode)
self.assertEqual("", run.task_output)
run2.refresh_from_db()
self.assertEqual(0, run2.task_exitcode)
self.assertEqual("", run2.task_output)
if settings.SCANCODEIO_ASYNC:
self.assertIsNotNone(run2.task_start_date)
self.assertEqual(run2.Status.QUEUED, run2.status)
else:
self.assertEqual(0, run2.task_exitcode)
self.assertEqual("", run2.task_output)

@mock.patch("scanpipe.pipelines.Pipeline.execute")
def test_scanpipe_tasks_execute_pipeline_no_run_next_on_failure(self, mock_execute):
Expand Down

0 comments on commit 3c3c5e4

Please sign in to comment.