mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 07:12:20 -05:00
Use new redis key for templates
Equivalent of https://github.com/alphagov/notifications-admin/pull/3639 but for the API. This is the only place in the API we appear to be getting setting templates or broadcast messages.
This commit is contained in:
@@ -55,7 +55,7 @@ class SerialisedTemplate(SerialisedModel):
|
||||
return cls(cls.get_dict(template_id, service_id)['data'])
|
||||
|
||||
@staticmethod
|
||||
@redis_cache.set('template-{template_id}-version-None')
|
||||
@redis_cache.set('service-{service_id}-template-{template_id}-version-None')
|
||||
def get_dict(template_id, service_id):
|
||||
from app.dao import templates_dao
|
||||
from app.schemas import template_schema
|
||||
|
||||
@@ -264,7 +264,7 @@ def test_should_cache_template_and_service_in_redis(mocker, client, sample_templ
|
||||
)
|
||||
|
||||
expected_service_key = f'service-{sample_template.service_id}'
|
||||
expected_templates_key = f'template-{sample_template.id}-version-None'
|
||||
expected_templates_key = f'service-{sample_template.service_id}-template-{sample_template.id}-version-None'
|
||||
|
||||
assert mock_redis_get.call_args_list == [
|
||||
call(expected_service_key),
|
||||
|
||||
Reference in New Issue
Block a user