diff --git a/app/celery/provider_tasks.py b/app/celery/provider_tasks.py index 6d4873d69..d41e4bf11 100644 --- a/app/celery/provider_tasks.py +++ b/app/celery/provider_tasks.py @@ -113,7 +113,7 @@ def send_sms_to_provider(self, service_id, notification_id): def provider_to_use(notification_type, notification_id): active_providers_in_order = [ provider for provider in get_provider_details_by_notification_type(notification_type) if provider.active - ] + ] if not active_providers_in_order: current_app.logger.error( diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 9dc332469..7ad57b09b 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -87,7 +87,7 @@ def process_job(job_id): 'personalisation': { key: personalisation.get(key) for key in template.placeholders - } + } }) if template.template_type == SMS_TYPE: diff --git a/app/clients/sms/mmg.py b/app/clients/sms/mmg.py index 9636be86b..0615c7a1c 100644 --- a/app/clients/sms/mmg.py +++ b/app/clients/sms/mmg.py @@ -73,7 +73,7 @@ class MMGClient(SmsClient): "reqType": "BULK", "MSISDN": to, "msg": content, - "sender": self.from_number if sender is None else sender, + "sender": self.from_number if sender is None else sender, "cid": reference, "multi": multi } diff --git a/app/dao/provider_statistics_dao.py b/app/dao/provider_statistics_dao.py index a7f13fbf4..9a29cffe0 100644 --- a/app/dao/provider_statistics_dao.py +++ b/app/dao/provider_statistics_dao.py @@ -9,7 +9,7 @@ from app.models import ( EMAIL_TYPE, NOTIFICATION_STATUS_TYPES_BILLABLE, KEY_TYPE_TEST - ) +) def get_provider_statistics(service, **kwargs): diff --git a/app/history_meta.py b/app/history_meta.py index 49a420572..c89fe06ca 100644 --- a/app/history_meta.py +++ b/app/history_meta.py @@ -201,10 +201,10 @@ def create_history(obj, history_cls=None): # not yet have a value before insert elif isinstance(prop, RelationshipProperty): - if hasattr(history, prop.key+'_id'): + if hasattr(history, prop.key + '_id'): foreign_obj = getattr(obj, prop.key) # if it's a nullable relationship, foreign_obj will be None, and we actually want to record that - data[prop.key+'_id'] = getattr(foreign_obj, 'id', None) + data[prop.key + '_id'] = getattr(foreign_obj, 'id', None) if not obj.version: obj.version = 1 diff --git a/app/schemas.py b/app/schemas.py index a28c4aa94..f9f66f0bf 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -427,7 +427,7 @@ class NotificationsFilterSchema(ma.Schema): class TemplateStatisticsSchema(BaseSchema): - template = fields.Nested(TemplateSchema, only=["id", "name", "template_type"], dump_only=True) + template = fields.Nested(TemplateSchema, only=["id", "name", "template_type"], dump_only=True) class Meta: model = models.TemplateStatistics diff --git a/requirements_for_test.txt b/requirements_for_test.txt index f5db40330..1ea6f7a8d 100644 --- a/requirements_for_test.txt +++ b/requirements_for_test.txt @@ -6,6 +6,6 @@ pytest-cov==2.2.0 coveralls==1.1 mock==1.0.1 moto==0.4.19 -flex==5.6.0 +flex==5.7.0 freezegun==0.3.6 requests-mock==0.7.0 diff --git a/setup.cfg b/setup.cfg index 4dcf235f8..c19f0a88a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [pep8] max-line-length = 120 +ignore = E402 exclude = ./migrations,./venv,./venv3 - diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 1d3612b01..ff99c1654 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -1110,7 +1110,7 @@ def test_set_sms_sender_for_service_rejects_invalid_characters(notify_api, sampl 'delivered': 0, 'failed': 0 }) - ], ids=['seven_days', 'today'] +], ids=['seven_days', 'today'] ) def test_get_detailed_service(notify_db, notify_db_session, notify_api, sample_service, today_only, stats): with notify_api.test_request_context(), notify_api.test_client() as client: diff --git a/tests/app/user/test_rest_verify.py b/tests/app/user/test_rest_verify.py index 58d626c92..fb7e1b7cb 100644 --- a/tests/app/user/test_rest_verify.py +++ b/tests/app/user/test_rest_verify.py @@ -236,13 +236,14 @@ def test_send_user_sms_code(notify_api, headers=[('Content-Type', 'application/json'), auth_header]) assert resp.status_code == 204 assert mocked.call_count == 1 - encrypted = encryption.encrypt({'template': current_app.config['SMS_CODE_TEMPLATE_ID'], - 'template_version': 1, - 'to': sample_user.mobile_number, - 'personalisation': { - 'verify_code': '11111' - } - }) + encrypted = encryption.encrypt({ + 'template': current_app.config['SMS_CODE_TEMPLATE_ID'], + 'template_version': 1, + 'to': sample_user.mobile_number, + 'personalisation': { + 'verify_code': '11111' + } + }) app.celery.tasks.send_sms.apply_async.assert_called_once_with( ([current_app.config['NOTIFY_SERVICE_ID'], "some_uuid", @@ -274,13 +275,14 @@ def test_send_user_code_for_sms_with_optional_to_field(notify_api, headers=[('Content-Type', 'application/json'), auth_header]) assert resp.status_code == 204 - encrypted = encryption.encrypt({'template': current_app.config['SMS_CODE_TEMPLATE_ID'], - 'template_version': 1, - 'to': '+441119876757', - 'personalisation': { - 'verify_code': '11111' - } - }) + encrypted = encryption.encrypt({ + 'template': current_app.config['SMS_CODE_TEMPLATE_ID'], + 'template_version': 1, + 'to': '+441119876757', + 'personalisation': { + 'verify_code': '11111' + } + }) assert mocked.call_count == 1 app.celery.tasks.send_sms.apply_async.assert_called_once_with( ([current_app.config['NOTIFY_SERVICE_ID'],