Added job_status to marshmallow

- ensured statues not deleted on test runs
- returns in API call

Merge branch 'add-new-column-to-jobs-for-delayed-sending' into scheduled-delivery-of-jobs

Conflicts:
	app/models.py
This commit is contained in:
Martyn Inglis
2016-08-24 14:35:22 +01:00
5 changed files with 70 additions and 58 deletions

View File

@@ -111,8 +111,7 @@ def test_get_job_by_id(notify_api, sample_job):
def test_create_job(notify_api, sample_template, mocker, fake_uuid):
with notify_api.test_request_context():
with notify_api.test_client() as client:
from time import sleep
sleep(30)
mocker.patch('app.celery.tasks.process_job.apply_async')
data = {
'id': fake_uuid,
@@ -125,6 +124,7 @@ def test_create_job(notify_api, sample_template, mocker, fake_uuid):
path = '/service/{}/job'.format(sample_template.service.id)
auth_header = create_authorization_header(service_id=sample_template.service.id)
headers = [('Content-Type', 'application/json'), auth_header]
response = client.post(
path,
data=json.dumps(data),
@@ -139,7 +139,8 @@ def test_create_job(notify_api, sample_template, mocker, fake_uuid):
resp_json = json.loads(response.get_data(as_text=True))
assert resp_json['data']['id'] == fake_uuid
assert resp_json['data']['service'] == str(sample_template.service.id)
assert resp_json['data']['status'] == 'pending'
assert resp_json['data']['job_status'] == 'pending'
assert resp_json['data']['template'] == str(sample_template.id)
assert resp_json['data']['original_file_name'] == 'thisisatest.csv'