mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Replace how .dump is called
As with `.load`, only data is now returned instead of a tuple.
This commit is contained in:
@@ -811,8 +811,8 @@ def test_send_sms_to_provider_should_return_template_if_found_in_redis(
|
||||
mocker, client, sample_template
|
||||
):
|
||||
from app.schemas import service_schema, template_schema
|
||||
service_dict = service_schema.dump(sample_template.service).data
|
||||
template_dict = template_schema.dump(sample_template).data
|
||||
service_dict = service_schema.dump(sample_template.service)
|
||||
template_dict = template_schema.dump(sample_template)
|
||||
|
||||
mocker.patch(
|
||||
'app.redis_store.get',
|
||||
@@ -846,8 +846,8 @@ def test_send_email_to_provider_should_return_template_if_found_in_redis(
|
||||
mocker, client, sample_email_template
|
||||
):
|
||||
from app.schemas import service_schema, template_schema
|
||||
service_dict = service_schema.dump(sample_email_template.service).data
|
||||
template_dict = template_schema.dump(sample_email_template).data
|
||||
service_dict = service_schema.dump(sample_email_template.service)
|
||||
template_dict = template_schema.dump(sample_email_template)
|
||||
|
||||
mocker.patch(
|
||||
'app.redis_store.get',
|
||||
|
||||
@@ -88,7 +88,7 @@ def test_should_create_a_new_template_for_a_service(
|
||||
|
||||
template = Template.query.get(json_resp['data']['id'])
|
||||
from app.schemas import template_schema
|
||||
assert sorted(json_resp['data']) == sorted(template_schema.dump(template).data)
|
||||
assert sorted(json_resp['data']) == sorted(template_schema.dump(template))
|
||||
|
||||
|
||||
def test_create_a_new_template_for_a_service_adds_folder_relationship(
|
||||
@@ -879,7 +879,7 @@ def test_create_a_template_with_reply_to(admin_request, sample_user):
|
||||
|
||||
template = Template.query.get(json_resp['data']['id'])
|
||||
from app.schemas import template_schema
|
||||
assert sorted(json_resp['data']) == sorted(template_schema.dump(template).data)
|
||||
assert sorted(json_resp['data']) == sorted(template_schema.dump(template))
|
||||
th = TemplateHistory.query.filter_by(id=template.id, version=1).one()
|
||||
assert th.service_letter_contact_id == letter_contact.id
|
||||
|
||||
|
||||
@@ -16,16 +16,15 @@ def test_job_schema_doesnt_return_notifications(sample_notification_with_job):
|
||||
job = sample_notification_with_job.job
|
||||
assert job.notifications.count() == 1
|
||||
|
||||
data, errors = job_schema.dump(job)
|
||||
data = job_schema.dump(job)
|
||||
|
||||
assert not errors
|
||||
assert 'notifications' not in data
|
||||
|
||||
|
||||
def test_notification_schema_ignores_absent_api_key(sample_notification_with_job):
|
||||
from app.schemas import notification_with_template_schema
|
||||
|
||||
data = notification_with_template_schema.dump(sample_notification_with_job).data
|
||||
data = notification_with_template_schema.dump(sample_notification_with_job)
|
||||
assert data['key_name'] is None
|
||||
|
||||
|
||||
@@ -35,7 +34,7 @@ def test_notification_schema_adds_api_key_name(sample_notification):
|
||||
api_key = create_api_key(sample_notification.service, key_name='Test key')
|
||||
sample_notification.api_key = api_key
|
||||
|
||||
data = notification_with_template_schema.dump(sample_notification).data
|
||||
data = notification_with_template_schema.dump(sample_notification)
|
||||
assert data['key_name'] == 'Test key'
|
||||
|
||||
|
||||
@@ -48,7 +47,7 @@ def test_notification_schema_adds_api_key_name(sample_notification):
|
||||
def test_notification_schema_has_correct_status(sample_notification, schema_name):
|
||||
from app import schemas
|
||||
|
||||
data = getattr(schemas, schema_name).dump(sample_notification).data
|
||||
data = getattr(schemas, schema_name).dump(sample_notification)
|
||||
|
||||
assert data['status'] == sample_notification.status
|
||||
|
||||
@@ -109,7 +108,7 @@ def test_provider_details_schema_returns_user_details(
|
||||
from app.schemas import provider_details_schema
|
||||
current_sms_provider = get_provider_details_by_identifier('mmg')
|
||||
current_sms_provider.created_by = sample_user
|
||||
data = provider_details_schema.dump(current_sms_provider).data
|
||||
data = provider_details_schema.dump(current_sms_provider)
|
||||
|
||||
assert sorted(data['created_by'].keys()) == sorted(['id', 'email_address', 'name'])
|
||||
|
||||
@@ -122,7 +121,7 @@ def test_provider_details_history_schema_returns_user_details(
|
||||
from app.schemas import provider_details_schema
|
||||
current_sms_provider = get_provider_details_by_identifier('mmg')
|
||||
current_sms_provider.created_by_id = sample_user.id
|
||||
data = provider_details_schema.dump(current_sms_provider).data
|
||||
data = provider_details_schema.dump(current_sms_provider)
|
||||
|
||||
dao_update_provider_details(current_sms_provider)
|
||||
|
||||
@@ -131,6 +130,6 @@ def test_provider_details_history_schema_returns_user_details(
|
||||
).order_by(
|
||||
desc(ProviderDetailsHistory.version)
|
||||
).first()
|
||||
data = provider_details_schema.dump(current_sms_provider_in_history).data
|
||||
data = provider_details_schema.dump(current_sms_provider_in_history)
|
||||
|
||||
assert sorted(data['created_by'].keys()) == sorted(['id', 'email_address', 'name'])
|
||||
|
||||
@@ -273,8 +273,8 @@ def test_should_cache_template_and_service_in_redis(mocker, client, sample_templ
|
||||
call(expected_templates_key),
|
||||
]
|
||||
|
||||
service_dict = service_schema.dump(sample_template.service).data
|
||||
template_dict = template_schema.dump(sample_template).data
|
||||
service_dict = service_schema.dump(sample_template.service)
|
||||
template_dict = template_schema.dump(sample_template)
|
||||
|
||||
assert len(mock_redis_set.call_args_list) == 2
|
||||
|
||||
@@ -292,8 +292,8 @@ def test_should_cache_template_and_service_in_redis(mocker, client, sample_templ
|
||||
def test_should_return_template_if_found_in_redis(mocker, client, sample_template):
|
||||
|
||||
from app.schemas import service_schema, template_schema
|
||||
service_dict = service_schema.dump(sample_template.service).data
|
||||
template_dict = template_schema.dump(sample_template).data
|
||||
service_dict = service_schema.dump(sample_template.service)
|
||||
template_dict = template_schema.dump(sample_template)
|
||||
|
||||
mocker.patch(
|
||||
'app.redis_store.get',
|
||||
|
||||
Reference in New Issue
Block a user