Added bucket name to task arguments.

This commit is contained in:
Rebecca Law
2017-04-06 12:18:34 +01:00
parent 970a4e7b4e
commit 7bd0a07f0d
2 changed files with 8 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
from flask import Blueprint
from flask import current_app
from flask import request
from app import notify_celery
@@ -13,6 +14,7 @@ register_errors(letter_job)
@letter_job.route('/send-letter-jobs', methods=['POST'])
def send_letter_jobs():
job_ids = validate(request.get_json(), letter_job_ids)
notify_celery.send_task(name="send_files_to_dvla", args=(job_ids['job_ids'],), queue="process-ftp")
notify_celery.send_task(name="send_files_to_dvla", args=(current_app.config.get("DVLA_UPLOAD_BUCKET_NAME"),
job_ids['job_ids'],), queue="process-ftp")
return "Task created to send files to DVLA"

View File

@@ -1,5 +1,6 @@
import uuid
from flask import current_app
from flask import json
from tests import create_authorization_header
@@ -19,7 +20,10 @@ def test_send_letter_jobs(client, mocker):
assert response.status_code == 200
assert response.get_data(as_text=True) == "Task created to send files to DVLA"
mock_celery.assert_called_once_with(name="send_files_to_dvla", args=(job_ids['job_ids'],), queue="process-ftp")
mock_celery.assert_called_once_with(name="send_files_to_dvla",
args=(current_app.config.get("DVLA_UPLOAD_BUCKET_NAME"),
job_ids['job_ids'],),
queue="process-ftp")
def test_send_letter_jobs_throws_validation_error(client, mocker):