mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-07 15:48:24 -04:00
use new send-jobs-to-dvla task instead of send-files-to-dvla
the tasks (on the ftp app) do the same thing, but to improve clarity i've renamed it to jobs, because we'll be adding a notifications one soon
This commit is contained in:
@@ -314,7 +314,7 @@ def populate_monthly_billing():
|
|||||||
def run_letter_jobs():
|
def run_letter_jobs():
|
||||||
job_ids = dao_get_letter_job_ids_by_status(JOB_STATUS_READY_TO_SEND)
|
job_ids = dao_get_letter_job_ids_by_status(JOB_STATUS_READY_TO_SEND)
|
||||||
notify_celery.send_task(
|
notify_celery.send_task(
|
||||||
name=TaskNames.DVLA_FILES,
|
name=TaskNames.DVLA_JOBS,
|
||||||
args=(job_ids,),
|
args=(job_ids,),
|
||||||
queue=QueueNames.PROCESS_FTP
|
queue=QueueNames.PROCESS_FTP
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ class QueueNames(object):
|
|||||||
|
|
||||||
|
|
||||||
class TaskNames(object):
|
class TaskNames(object):
|
||||||
DVLA_FILES = 'send-files-to-dvla'
|
DVLA_JOBS = 'send-jobs-to-dvla'
|
||||||
|
DVLA_NOTIFICATIONS = 'send-notifications-to-dvla'
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
@@ -226,7 +227,7 @@ class Config(object):
|
|||||||
},
|
},
|
||||||
'run-letter-jobs': {
|
'run-letter-jobs': {
|
||||||
'task': 'run-letter-jobs',
|
'task': 'run-letter-jobs',
|
||||||
'schedule': crontab(minute=30, hour=17),
|
'schedule': crontab(hour=17, minute=30),
|
||||||
'options': {'queue': QueueNames.PERIODIC}
|
'options': {'queue': QueueNames.PERIODIC}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ register_errors(letter_job)
|
|||||||
@letter_job.route('/send-letter-jobs', methods=['POST'])
|
@letter_job.route('/send-letter-jobs', methods=['POST'])
|
||||||
def send_letter_jobs():
|
def send_letter_jobs():
|
||||||
job_ids = validate(request.get_json(), letter_job_ids)
|
job_ids = validate(request.get_json(), letter_job_ids)
|
||||||
notify_celery.send_task(name=TaskNames.DVLA_FILES, args=(job_ids['job_ids'],), queue=QueueNames.PROCESS_FTP)
|
notify_celery.send_task(name=TaskNames.DVLA_JOBS, args=(job_ids['job_ids'],), queue=QueueNames.PROCESS_FTP)
|
||||||
|
|
||||||
return jsonify(data={"response": "Task created to send files to DVLA"}), 201
|
return jsonify(data={"response": "Task created to send files to DVLA"}), 201
|
||||||
|
|
||||||
|
|||||||
@@ -690,6 +690,6 @@ def test_run_letter_jobs(client, mocker, sample_letter_template):
|
|||||||
|
|
||||||
run_letter_jobs()
|
run_letter_jobs()
|
||||||
|
|
||||||
mock_celery.assert_called_once_with(name=TaskNames.DVLA_FILES,
|
mock_celery.assert_called_once_with(name=TaskNames.DVLA_JOBS,
|
||||||
args=(job_ids,),
|
args=(job_ids,),
|
||||||
queue=QueueNames.PROCESS_FTP)
|
queue=QueueNames.PROCESS_FTP)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ def test_send_letter_jobs(client, mocker, sample_letter_template):
|
|||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
assert json.loads(response.get_data())['data'] == {'response': "Task created to send files to DVLA"}
|
assert json.loads(response.get_data())['data'] == {'response': "Task created to send files to DVLA"}
|
||||||
|
|
||||||
mock_celery.assert_called_once_with(name="send-files-to-dvla",
|
mock_celery.assert_called_once_with(name="send-jobs-to-dvla",
|
||||||
args=(job_ids['job_ids'],),
|
args=(job_ids['job_ids'],),
|
||||||
queue="process-ftp-tasks")
|
queue="process-ftp-tasks")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user