mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-18 05:30:48 -04:00
Merge branch 'master' into sent-status
This commit is contained in:
@@ -13,6 +13,16 @@ from app.models import NotificationStatistics
|
||||
from tests.app.conftest import sample_notification as create_sample_notification
|
||||
|
||||
|
||||
def test_dvla_callback_should_not_need_auth(client):
|
||||
data = json.dumps({"somekey": "somevalue"})
|
||||
response = client.post(
|
||||
path='/notifications/letter/dvla',
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json')])
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_firetext_callback_should_not_need_auth(client, mocker):
|
||||
mocker.patch('app.statsd_client.incr')
|
||||
response = client.post(
|
||||
|
||||
@@ -169,18 +169,21 @@ def test_persist_notification_with_optionals(sample_job, sample_api_key, mocker)
|
||||
'app.notifications.process_notifications.redis_store.get_all_from_hash')
|
||||
n_id = uuid.uuid4()
|
||||
created_at = datetime.datetime(2016, 11, 11, 16, 8, 18)
|
||||
persist_notification(template_id=sample_job.template.id,
|
||||
template_version=sample_job.template.version,
|
||||
recipient='+447111111111',
|
||||
service=sample_job.service,
|
||||
personalisation=None, notification_type='sms',
|
||||
api_key_id=sample_api_key.id,
|
||||
key_type=sample_api_key.key_type,
|
||||
created_at=created_at,
|
||||
job_id=sample_job.id,
|
||||
job_row_number=10,
|
||||
client_reference="ref from client",
|
||||
notification_id=n_id)
|
||||
persist_notification(
|
||||
template_id=sample_job.template.id,
|
||||
template_version=sample_job.template.version,
|
||||
recipient='+447111111111',
|
||||
service=sample_job.service,
|
||||
personalisation=None,
|
||||
notification_type='sms',
|
||||
api_key_id=sample_api_key.id,
|
||||
key_type=sample_api_key.key_type,
|
||||
created_at=created_at,
|
||||
job_id=sample_job.id,
|
||||
job_row_number=10,
|
||||
client_reference="ref from client",
|
||||
notification_id=n_id
|
||||
)
|
||||
assert Notification.query.count() == 1
|
||||
assert NotificationHistory.query.count() == 1
|
||||
persisted_notification = Notification.query.all()[0]
|
||||
@@ -192,6 +195,9 @@ def test_persist_notification_with_optionals(sample_job, sample_api_key, mocker)
|
||||
mock_service_template_cache.assert_called_once_with(cache_key_for_service_template_counter(sample_job.service_id))
|
||||
assert persisted_notification.client_reference == "ref from client"
|
||||
assert persisted_notification.reference is None
|
||||
assert persisted_notification.international is False
|
||||
assert persisted_notification.phone_prefix is None
|
||||
assert persisted_notification.rate_multiplier is None
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 11:09:00.061258")
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_get_provider_details_contains_correct_fields(client, notify_db):
|
||||
allowed_keys = {
|
||||
"id", "created_by", "display_name",
|
||||
"identifier", "priority", 'notification_type',
|
||||
"active", "version", "updated_at"
|
||||
"active", "version", "updated_at", "supports_international"
|
||||
}
|
||||
assert allowed_keys == set(json_resp[0].keys())
|
||||
|
||||
@@ -116,7 +116,7 @@ def test_get_provider_versions_contains_correct_fields(client, notify_db):
|
||||
allowed_keys = {
|
||||
"id", "created_by", "display_name",
|
||||
"identifier", "priority", 'notification_type',
|
||||
"active", "version", "updated_at"
|
||||
"active", "version", "updated_at", "supports_international"
|
||||
}
|
||||
assert allowed_keys == set(json_resp[0].keys())
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ def test_create_service(client, sample_user):
|
||||
assert json_resp['data']['name'] == 'created service'
|
||||
assert not json_resp['data']['research_mode']
|
||||
assert not json_resp['data']['can_send_letters']
|
||||
assert not json_resp['data']['can_send_international_sms']
|
||||
|
||||
|
||||
def test_should_not_create_service_with_missing_user_id_field(notify_api, fake_uuid):
|
||||
@@ -419,10 +420,12 @@ def test_update_service_flags(notify_api, sample_service):
|
||||
assert json_resp['data']['name'] == sample_service.name
|
||||
assert json_resp['data']['research_mode'] is False
|
||||
assert json_resp['data']['can_send_letters'] is False
|
||||
assert json_resp['data']['can_send_international_sms'] is False
|
||||
|
||||
data = {
|
||||
'research_mode': True,
|
||||
'can_send_letters': True
|
||||
'can_send_letters': True,
|
||||
'can_send_international_sms': True,
|
||||
}
|
||||
|
||||
auth_header = create_authorization_header()
|
||||
@@ -436,6 +439,7 @@ def test_update_service_flags(notify_api, sample_service):
|
||||
assert resp.status_code == 200
|
||||
assert result['data']['research_mode'] is True
|
||||
assert result['data']['can_send_letters'] is True
|
||||
assert result['data']['can_send_international_sms'] is True
|
||||
|
||||
|
||||
def test_update_service_research_mode_throws_validation_error(notify_api, sample_service):
|
||||
|
||||
Reference in New Issue
Block a user