From 2d9a449d1ef4a04c04becc08d147d1eeb69c4958 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Fri, 7 Apr 2017 14:36:00 +0100 Subject: [PATCH] Changed styling --- app/celery/tasks.py | 24 ++++++++++++------------ app/dao/notifications_dao.py | 12 ++++++------ app/schemas.py | 4 ++-- tests/app/dao/test_notification_dao.py | 4 ++-- tests/app/job/test_rest.py | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index aa9b37d28..f507b34b7 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -308,18 +308,18 @@ def update_job_to_sent_to_dvla(self, job_id): def create_dvla_file_contents(job_id): - file_contents = '\n'.join( - str(LetterDVLATemplate( - notification.template.__dict__, - notification.personalisation, - # This unique id is a 7 digits requested by DVLA, not known - # if this number needs to be sequential. - numeric_id=random.randint(1, int('9' * 7)), - contact_block=notification.service.letter_contact_block, - )) - for notification in dao_get_all_notifications_for_job(job_id) - ) - return file_contents + file_contents = '\n'.join( + str(LetterDVLATemplate( + notification.template.__dict__, + notification.personalisation, + # This unique id is a 7 digits requested by DVLA, not known + # if this number needs to be sequential. + numeric_id=random.randint(1, int('9' * 7)), + contact_block=notification.service.letter_contact_block, + )) + for notification in dao_get_all_notifications_for_job(job_id) + ) + return file_contents def s3upload(filedata, region, bucket_name, file_location): diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index 5654051e2..768951ca2 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -444,12 +444,12 @@ def is_delivery_slow_for_provider( @statsd(namespace="dao") @transactional def dao_update_notifications_sent_to_dvla(job_id, provider): - updated_count = db.session.query(Notification - ).filter(Notification.job_id == job_id - ).update({'status': 'sending', "sent_by": provider}) + updated_count = db.session.query( + Notification).filter(Notification.job_id == job_id).update( + {'status': 'sending', "sent_by": provider}) - db.session.query(NotificationHistory - ).filter(NotificationHistory.job_id == job_id - ).update({'status': 'sending', "sent_by": provider}) + db.session.query( + NotificationHistory).filter(NotificationHistory.job_id == job_id).update( + {'status': 'sending', "sent_by": provider}) return updated_count diff --git a/app/schemas.py b/app/schemas.py index 8ed2eb498..203ba0934 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -283,8 +283,8 @@ class JobSchema(BaseSchema): job_status = field_for(models.JobStatus, 'name', required=False) scheduled_for = fields.DateTime() - service_name = fields.Nested(ServiceSchema, attribute="service", dump_to="service_name", only=["name"], - dump_only=True) + service_name = fields.Nested( + ServiceSchema, attribute="service", dump_to="service_name", only=["name"], dump_only=True) @validates('scheduled_for') def validate_scheduled_for(self, value): diff --git a/tests/app/dao/test_notification_dao.py b/tests/app/dao/test_notification_dao.py index 7ffb895bc..aa957efe7 100644 --- a/tests/app/dao/test_notification_dao.py +++ b/tests/app/dao/test_notification_dao.py @@ -1571,8 +1571,8 @@ def test_dao_update_notifications_sent_to_dvla(notify_db, notify_db_session, sam def test_dao_update_notifications_sent_to_dvla_does_update_history_if_test_key( notify_db, notify_db_session, sample_letter_template, sample_api_key): job = sample_job(notify_db=notify_db, notify_db_session=notify_db_session, template=sample_letter_template) - notification = create_notification(template=sample_letter_template, job=job, api_key_id=sample_api_key.id, - key_type='test') + notification = create_notification( + template=sample_letter_template, job=job, api_key_id=sample_api_key.id, key_type='test') updated_count = dao_update_notifications_sent_to_dvla(job_id=job.id, provider='some provider') diff --git a/tests/app/job/test_rest.py b/tests/app/job/test_rest.py index 32a5bdfcb..40e30d38e 100644 --- a/tests/app/job/test_rest.py +++ b/tests/app/job/test_rest.py @@ -674,7 +674,7 @@ def test_get_jobs_accepts_page_parameter( ('', JOB_STATUS_TYPES), ('pending', [JOB_STATUS_PENDING]), ('pending, in progress, finished, sending limits exceeded, scheduled, cancelled, ready to send, sent to dvla', - JOB_STATUS_TYPES), + JOB_STATUS_TYPES), # bad statuses are accepted, just return no data ('foo', []) ])