mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Add more properties of job to job message.
This commit is contained in:
@@ -61,7 +61,15 @@ def _enqueue_job(job):
|
|||||||
queue_name = current_app.config['NOTIFY_JOB_QUEUE']
|
queue_name = current_app.config['NOTIFY_JOB_QUEUE']
|
||||||
|
|
||||||
queue = boto3.resource('sqs', region_name=aws_region).create_queue(QueueName=queue_name)
|
queue = boto3.resource('sqs', region_name=aws_region).create_queue(QueueName=queue_name)
|
||||||
job_json = json.dumps({'job_id': str(job.id), 'service_id': str(job.service.id)})
|
data = {
|
||||||
|
'job_id': str(job.id),
|
||||||
|
'service_id': str(job.service.id),
|
||||||
|
'template_id': job.template_id,
|
||||||
|
'bucket_name': job.bucket_name
|
||||||
|
}
|
||||||
|
job_json = json.dumps(data)
|
||||||
queue.send_message(MessageBody=job_json,
|
queue.send_message(MessageBody=job_json,
|
||||||
MessageAttributes={'job_id': {'StringValue': str(job.id), 'DataType': 'String'},
|
MessageAttributes={'job_id': {'StringValue': str(job.id), 'DataType': 'String'},
|
||||||
'service_id': {'StringValue': str(job.service.id), 'DataType': 'String'}})
|
'service_id': {'StringValue': str(job.service.id), 'DataType': 'String'},
|
||||||
|
'template_id': {'StringValue': str(job.template_id), 'DataType': 'Number'},
|
||||||
|
'bucket_name': {'StringValue': job.bucket_name, 'DataType': 'String'}})
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ def test_create_job(notify_api, notify_db, notify_db_session, sample_template):
|
|||||||
expected_message = json.loads(messages[0].body)
|
expected_message = json.loads(messages[0].body)
|
||||||
assert expected_message['job_id'] == str(job_id)
|
assert expected_message['job_id'] == str(job_id)
|
||||||
assert expected_message['service_id'] == str(service_id)
|
assert expected_message['service_id'] == str(service_id)
|
||||||
|
assert expected_message['template_id'] == template_id
|
||||||
|
assert expected_message['bucket_name'] == bucket_name
|
||||||
|
|
||||||
|
|
||||||
def _setup_jobs(notify_db, notify_db_session, template, number_of_jobs=5):
|
def _setup_jobs(notify_db, notify_db_session, template, number_of_jobs=5):
|
||||||
|
|||||||
Reference in New Issue
Block a user