Skip to content

Commit

Permalink
Fix failing tests #1325
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Jul 25, 2024
1 parent 08eb53f commit 1af05ed
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions scanpipe/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

from unittest import mock

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

from scanpipe import tasks
from scanpipe.models import Project
Expand All @@ -45,6 +45,7 @@ def test_scanpipe_tasks_execute_pipeline_task(self, mock_execute):
self.assertIsNotNone(run.task_start_date)
self.assertIsNotNone(run.task_end_date)

@override_settings(SCANCODEIO_ASYNC=False)
@mock.patch("scanpipe.pipelines.Pipeline.execute")
def test_scanpipe_tasks_execute_pipeline_run_next_on_success(self, mock_execute):
project = Project.objects.create(name="my_project")
Expand All @@ -59,11 +60,8 @@ def test_scanpipe_tasks_execute_pipeline_run_next_on_success(self, mock_execute)
self.assertEqual(0, run.task_exitcode)
self.assertEqual("", run.task_output)
run2.refresh_from_db()
if settings.SCANCODEIO_ASYNC:
self.assertEqual(run2.Status.QUEUED, run2.status)
else:
self.assertEqual(0, run2.task_exitcode)
self.assertEqual("", run2.task_output)
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 All @@ -87,6 +85,7 @@ def test_scanpipe_tasks_execute_pipeline_no_run_next_on_failure(self, mock_execu
self.assertIsNone(run2.task_start_date)
self.assertIsNone(run2.task_end_date)

@override_settings(SCANCODEIO_ASYNC=False)
@mock.patch("requests.post")
@mock.patch("scanpipe.pipelines.Pipeline.execute")
def test_scanpipe_tasks_execute_pipeline_task_subscriptions(
Expand Down

0 comments on commit 1af05ed

Please sign in to comment.