use config to get default sender rather than hardcoding

this means that on non-prod envs, it reflects that environment.

it needs to be a lamdba, because the column object is created at import
time, when current_app.config won't have been loaded - this means that
when you create a Service object, that lambda executes and grabs the
correct default value
This commit is contained in:
Leo Hemsted
2017-05-23 10:35:13 +01:00
parent 2535a7fe98
commit 86c9600b04
4 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
import uuid
import pytest
from flask import json
from flask import json, current_app
from app.models import Notification
from app.v2.errors import RateLimitError
from tests import create_authorization_header
@@ -33,8 +35,7 @@ def test_post_sms_notification_returns_201(notify_api, sample_template_with_plac
assert resp_json['id'] == str(notification_id)
assert resp_json['reference'] == reference
assert resp_json['content']['body'] == sample_template_with_placeholders.content.replace("(( Name))", "Jo")
# conftest fixture service does not have a sms sender, use config default
assert resp_json['content']['from_number'] == 'GOVUK'
assert resp_json['content']['from_number'] == current_app.config['FROM_NUMBER']
assert 'v2/notifications/{}'.format(notification_id) in resp_json['uri']
assert resp_json['template']['id'] == str(sample_template_with_placeholders.id)
assert resp_json['template']['version'] == sample_template_with_placeholders.version