Merged provider stats only on success branch

- ensures that don't raise stats in research mode
This commit is contained in:
Martyn Inglis
2016-06-02 09:30:01 +01:00
parent 001149c263
commit 099c17192d
2 changed files with 12 additions and 13 deletions

View File

@@ -268,11 +268,11 @@ def send_sms(service_id, notification_id, encrypted_notification, created_at):
reference=str(notification_id)
)
update_notification_after_sent_to_provider(
notification_id,
'sms',
provider.get_name()
)
update_notification_after_sent_to_provider(
notification_id,
'sms',
provider.get_name()
)
except SmsClientException as e:
current_app.logger.error(
@@ -349,12 +349,12 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
reply_to_addresses=reply_to_addresses,
)
update_notification_after_sent_to_provider(
notification_id,
'email',
provider.get_name(),
reference=reference
)
update_notification_after_sent_to_provider(
notification_id,
'email',
provider.get_name(),
reference=reference
)
except EmailClientException as e:
current_app.logger.exception(e)

View File

@@ -331,8 +331,7 @@ def test_should_process_all_sms_job(sample_job,
)
assert encryption.encrypt.call_args[0][0]['to'] == '+441234123120'
assert encryption.encrypt.call_args[0][0]['template'] == str(sample_job_with_placeholdered_template.template.id)
assert encryption.encrypt.call_args[0][0][
'template_version'] == sample_job_with_placeholdered_template.template.version
assert encryption.encrypt.call_args[0][0]['template_version'] == sample_job_with_placeholdered_template.template.version # noqa
assert encryption.encrypt.call_args[0][0]['personalisation'] == {'name': 'chris'}
tasks.send_sms.apply_async.call_count == 10
job = jobs_dao.dao_get_job_by_id(sample_job_with_placeholdered_template.id)