From 8304fc09915fbdf6d90593c5bc0b2bdebb0af8bc Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 20 Feb 2018 11:38:55 -0500 Subject: [PATCH] Fixed unit test --- app/tests/test_api_task.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/tests/test_api_task.py b/app/tests/test_api_task.py index c35f509a..60dab5ee 100644 --- a/app/tests/test_api_task.py +++ b/app/tests/test_api_task.py @@ -299,7 +299,10 @@ class TestApiTask(BootTransactionTestCase): task_assets_path = os.path.join(settings.MEDIA_ROOT, task_directory_path(task.id, task.project.id)) self.assertFalse(os.path.exists(task_assets_path)) - # Create a task, then kill the processing node + # Stop processing node + node_odm.terminate() + + # Create a task res = client.post("/api/projects/{}/tasks/".format(project.id), { 'images': [image1, image2], 'name': 'test_task_offline', @@ -309,13 +312,6 @@ class TestApiTask(BootTransactionTestCase): self.assertTrue(res.status_code == status.HTTP_201_CREATED) task = Task.objects.get(pk=res.data['id']) - # Stop processing node - node_odm.terminate() - - task.refresh_from_db() - self.assertTrue(task.last_error is None) - worker.tasks.process_pending_tasks() - # Processing should fail and set an error task.refresh_from_db() self.assertTrue(task.last_error is not None)