From adf5b5baf5817623cea9b8fe28de3c72d3dd7c9e Mon Sep 17 00:00:00 2001
From: Nathaniel Kofalt <nathaniel@kofalt.com>
Date: Tue, 20 Feb 2018 06:52:31 -0600
Subject: [PATCH] Jobs must be running before results are uploaded

---
 tests/integration_tests/python/test_jobs.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/tests/integration_tests/python/test_jobs.py b/tests/integration_tests/python/test_jobs.py
index 57e09e91..72d76622 100644
--- a/tests/integration_tests/python/test_jobs.py
+++ b/tests/integration_tests/python/test_jobs.py
@@ -418,6 +418,8 @@ def test_failed_job_output(data_builder, default_payload, as_user, as_admin, as_
         }
     }
 
+    api_db.jobs.update_one({'_id': bson.ObjectId(job)}, {'$set':{'state': 'running'}})
+
     r = as_drone.post('/engine',
         params={'level': 'acquisition', 'id': acquisition, 'job': job, 'job_ticket': job_ticket['_id']},
         files=file_form('result.txt', meta=metadata)
@@ -441,16 +443,6 @@ def test_failed_job_output(data_builder, default_payload, as_user, as_admin, as_
     r = as_user.post('/jobs/' + job + '/accept-failed-output')
     assert r.status_code == 403
 
-    # try to accept failed output - job is not in failed state yet
-    r = as_admin.post('/jobs/' + job + '/accept-failed-output')
-    assert r.status_code == 400
-
-    # set job state to failed
-    r = as_drone.put('/jobs/' + job, json={'state': 'running'})
-    assert r.ok
-    r = as_drone.put('/jobs/' + job, json={'state': 'failed'})
-    assert r.ok
-
     # accept failed output
     r = as_admin.post('/jobs/' + job + '/accept-failed-output')
     assert r.ok
-- 
GitLab