2015-01-28 12:35:27 +00:00
|
|
|
from django.contrib.messages import constants, get_level, set_level, utils
|
2010-03-21 13:47:50 +00:00
|
|
|
from django.contrib.messages.api import MessageFailure
|
2013-10-28 20:52:11 +00:00
|
|
|
from django.contrib.messages.constants import DEFAULT_LEVELS
|
2015-01-28 12:35:27 +00:00
|
|
|
from django.contrib.messages.storage import base, default_storage
|
2009-12-09 16:57:23 +00:00
|
|
|
from django.contrib.messages.storage.base import Message
|
2017-02-25 06:48:20 +00:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
2013-12-23 15:01:13 +00:00
|
|
|
from django.test import modify_settings, override_settings
|
2015-12-30 15:51:16 +00:00
|
|
|
from django.urls import reverse
|
2017-01-26 19:58:33 +00:00
|
|
|
from django.utils.translation import gettext_lazy
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
def add_level_messages(storage):
|
|
|
|
"""
|
2017-01-05 14:23:39 +00:00
|
|
|
Add 6 messages from different levels (including a custom one) to a storage
|
2009-12-09 16:57:23 +00:00
|
|
|
instance.
|
|
|
|
"""
|
|
|
|
storage.add(constants.INFO, 'A generic info message')
|
|
|
|
storage.add(29, 'Some custom level')
|
|
|
|
storage.add(constants.DEBUG, 'A debugging message', extra_tags='extra-tag')
|
|
|
|
storage.add(constants.WARNING, 'A warning')
|
|
|
|
storage.add(constants.ERROR, 'An error')
|
|
|
|
storage.add(constants.SUCCESS, 'This was a triumph.')
|
|
|
|
|
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
class override_settings_tags(override_settings):
|
2013-09-03 18:22:21 +00:00
|
|
|
def enable(self):
|
2017-01-21 13:13:44 +00:00
|
|
|
super().enable()
|
2011-10-22 23:39:09 +00:00
|
|
|
# LEVEL_TAGS is a constant defined in the
|
|
|
|
# django.contrib.messages.storage.base module, so after changing
|
2017-01-05 14:23:39 +00:00
|
|
|
# settings.MESSAGE_TAGS, update that constant also.
|
2011-10-22 23:39:09 +00:00
|
|
|
self.old_level_tags = base.LEVEL_TAGS
|
|
|
|
base.LEVEL_TAGS = utils.get_level_tags()
|
2013-09-03 18:22:21 +00:00
|
|
|
|
|
|
|
def disable(self):
|
2017-01-21 13:13:44 +00:00
|
|
|
super().disable()
|
2011-10-22 23:39:09 +00:00
|
|
|
base.LEVEL_TAGS = self.old_level_tags
|
|
|
|
|
|
|
|
|
2017-01-19 07:39:46 +00:00
|
|
|
class BaseTests:
|
2009-12-09 16:57:23 +00:00
|
|
|
storage_class = default_storage
|
|
|
|
levels = {
|
|
|
|
'debug': constants.DEBUG,
|
|
|
|
'info': constants.INFO,
|
|
|
|
'success': constants.SUCCESS,
|
|
|
|
'warning': constants.WARNING,
|
|
|
|
'error': constants.ERROR,
|
|
|
|
}
|
|
|
|
|
|
|
|
def setUp(self):
|
2011-10-22 23:39:09 +00:00
|
|
|
self.settings_override = override_settings_tags(
|
2014-12-17 21:51:42 +00:00
|
|
|
TEMPLATES=[{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': (
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
),
|
|
|
|
},
|
|
|
|
}],
|
2015-02-10 13:30:35 +00:00
|
|
|
ROOT_URLCONF='messages_tests.urls',
|
2017-12-08 09:33:30 +00:00
|
|
|
MESSAGE_TAGS={},
|
2017-01-05 14:23:39 +00:00
|
|
|
MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__, self.storage_class.__name__),
|
2013-11-03 09:22:11 +00:00
|
|
|
SESSION_SERIALIZER='django.contrib.sessions.serializers.JSONSerializer',
|
2011-10-22 23:39:09 +00:00
|
|
|
)
|
|
|
|
self.settings_override.enable()
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def tearDown(self):
|
2011-10-22 23:39:09 +00:00
|
|
|
self.settings_override.disable()
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def get_request(self):
|
2017-02-25 06:48:20 +00:00
|
|
|
return HttpRequest()
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def get_response(self):
|
2017-02-25 06:48:20 +00:00
|
|
|
return HttpResponse()
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def get_storage(self, data=None):
|
|
|
|
"""
|
2017-01-05 14:23:39 +00:00
|
|
|
Return the storage backend, setting its loaded data to the ``data``
|
2009-12-09 16:57:23 +00:00
|
|
|
argument.
|
|
|
|
|
|
|
|
This method avoids the storage ``_get`` method from getting called so
|
|
|
|
that other parts of the storage backend can be tested independent of
|
|
|
|
the message retrieval logic.
|
|
|
|
"""
|
|
|
|
storage = self.storage_class(self.get_request())
|
|
|
|
storage._loaded_data = data or []
|
|
|
|
return storage
|
|
|
|
|
|
|
|
def test_add(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
self.assertFalse(storage.added_new)
|
|
|
|
storage.add(constants.INFO, 'Test message 1')
|
2010-12-07 13:57:01 +00:00
|
|
|
self.assertTrue(storage.added_new)
|
2009-12-09 16:57:23 +00:00
|
|
|
storage.add(constants.INFO, 'Test message 2', extra_tags='tag')
|
|
|
|
self.assertEqual(len(storage), 2)
|
|
|
|
|
|
|
|
def test_add_lazy_translation(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
response = self.get_response()
|
|
|
|
|
2017-01-26 19:58:33 +00:00
|
|
|
storage.add(constants.INFO, gettext_lazy('lazy message'))
|
2009-12-09 16:57:23 +00:00
|
|
|
storage.update(response)
|
|
|
|
|
|
|
|
storing = self.stored_messages_count(storage, response)
|
|
|
|
self.assertEqual(storing, 1)
|
|
|
|
|
|
|
|
def test_no_update(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
response = self.get_response()
|
|
|
|
storage.update(response)
|
|
|
|
storing = self.stored_messages_count(storage, response)
|
|
|
|
self.assertEqual(storing, 0)
|
|
|
|
|
|
|
|
def test_add_update(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
response = self.get_response()
|
|
|
|
|
|
|
|
storage.add(constants.INFO, 'Test message 1')
|
|
|
|
storage.add(constants.INFO, 'Test message 1', extra_tags='tag')
|
|
|
|
storage.update(response)
|
|
|
|
|
|
|
|
storing = self.stored_messages_count(storage, response)
|
|
|
|
self.assertEqual(storing, 2)
|
|
|
|
|
|
|
|
def test_existing_add_read_update(self):
|
|
|
|
storage = self.get_existing_storage()
|
|
|
|
response = self.get_response()
|
|
|
|
|
|
|
|
storage.add(constants.INFO, 'Test message 3')
|
|
|
|
list(storage) # Simulates a read
|
|
|
|
storage.update(response)
|
|
|
|
|
|
|
|
storing = self.stored_messages_count(storage, response)
|
|
|
|
self.assertEqual(storing, 0)
|
|
|
|
|
|
|
|
def test_existing_read_add_update(self):
|
|
|
|
storage = self.get_existing_storage()
|
|
|
|
response = self.get_response()
|
|
|
|
|
|
|
|
list(storage) # Simulates a read
|
|
|
|
storage.add(constants.INFO, 'Test message 3')
|
|
|
|
storage.update(response)
|
|
|
|
|
|
|
|
storing = self.stored_messages_count(storage, response)
|
|
|
|
self.assertEqual(storing, 1)
|
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
|
2009-12-09 16:57:23 +00:00
|
|
|
def test_full_request_response_cycle(self):
|
|
|
|
"""
|
2017-01-05 14:23:39 +00:00
|
|
|
With the message middleware enabled, messages are properly stored and
|
|
|
|
retrieved across the full request/redirect/response cycle.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
|
|
|
data = {
|
2012-09-07 23:23:16 +00:00
|
|
|
'messages': ['Test message %d' % x for x in range(5)],
|
2009-12-09 16:57:23 +00:00
|
|
|
}
|
2014-06-03 11:30:14 +00:00
|
|
|
show_url = reverse('show_message')
|
2009-12-09 16:57:23 +00:00
|
|
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
2014-06-03 11:30:14 +00:00
|
|
|
add_url = reverse('add_message', args=(level,))
|
2009-12-09 16:57:23 +00:00
|
|
|
response = self.client.post(add_url, data, follow=True)
|
|
|
|
self.assertRedirects(response, show_url)
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertIn('messages', response.context)
|
2013-12-12 20:23:24 +00:00
|
|
|
messages = [Message(self.levels[level], msg) for msg in data['messages']]
|
2009-12-09 16:57:23 +00:00
|
|
|
self.assertEqual(list(response.context['messages']), messages)
|
|
|
|
for msg in data['messages']:
|
|
|
|
self.assertContains(response, msg)
|
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
|
2010-12-07 13:57:01 +00:00
|
|
|
def test_with_template_response(self):
|
|
|
|
data = {
|
2012-09-07 23:23:16 +00:00
|
|
|
'messages': ['Test message %d' % x for x in range(5)],
|
2010-12-07 13:57:01 +00:00
|
|
|
}
|
2014-06-03 11:30:14 +00:00
|
|
|
show_url = reverse('show_template_response')
|
2017-05-27 23:08:46 +00:00
|
|
|
for level in self.levels:
|
2014-06-03 11:30:14 +00:00
|
|
|
add_url = reverse('add_template_response', args=(level,))
|
2010-12-07 13:57:01 +00:00
|
|
|
response = self.client.post(add_url, data, follow=True)
|
|
|
|
self.assertRedirects(response, show_url)
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertIn('messages', response.context)
|
2010-12-07 13:57:01 +00:00
|
|
|
for msg in data['messages']:
|
|
|
|
self.assertContains(response, msg)
|
|
|
|
|
|
|
|
# there shouldn't be any messages on second GET request
|
|
|
|
response = self.client.get(show_url)
|
|
|
|
for msg in data['messages']:
|
|
|
|
self.assertNotContains(response, msg)
|
|
|
|
|
2013-10-28 20:52:11 +00:00
|
|
|
def test_context_processor_message_levels(self):
|
2014-06-03 11:30:14 +00:00
|
|
|
show_url = reverse('show_template_response')
|
2013-10-28 20:52:11 +00:00
|
|
|
response = self.client.get(show_url)
|
|
|
|
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertIn('DEFAULT_MESSAGE_LEVELS', response.context)
|
2013-10-28 20:52:11 +00:00
|
|
|
self.assertEqual(response.context['DEFAULT_MESSAGE_LEVELS'], DEFAULT_LEVELS)
|
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
|
2009-12-09 16:57:23 +00:00
|
|
|
def test_multiple_posts(self):
|
|
|
|
"""
|
2016-10-27 07:53:39 +00:00
|
|
|
Messages persist properly when multiple POSTs are made before a GET.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
|
|
|
data = {
|
2012-09-07 23:23:16 +00:00
|
|
|
'messages': ['Test message %d' % x for x in range(5)],
|
2009-12-09 16:57:23 +00:00
|
|
|
}
|
2014-06-03 11:30:14 +00:00
|
|
|
show_url = reverse('show_message')
|
2009-12-09 16:57:23 +00:00
|
|
|
messages = []
|
|
|
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
2014-12-06 21:00:09 +00:00
|
|
|
messages.extend(Message(self.levels[level], msg) for msg in data['messages'])
|
2014-06-03 11:30:14 +00:00
|
|
|
add_url = reverse('add_message', args=(level,))
|
2009-12-09 16:57:23 +00:00
|
|
|
self.client.post(add_url, data)
|
|
|
|
response = self.client.get(show_url)
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertIn('messages', response.context)
|
2009-12-09 16:57:23 +00:00
|
|
|
self.assertEqual(list(response.context['messages']), messages)
|
|
|
|
for msg in data['messages']:
|
|
|
|
self.assertContains(response, msg)
|
|
|
|
|
2013-12-23 09:37:34 +00:00
|
|
|
@modify_settings(
|
|
|
|
INSTALLED_APPS={'remove': 'django.contrib.messages'},
|
2015-11-07 15:12:37 +00:00
|
|
|
MIDDLEWARE={'remove': 'django.contrib.messages.middleware.MessageMiddleware'},
|
2011-10-22 23:39:09 +00:00
|
|
|
)
|
2014-12-17 21:51:42 +00:00
|
|
|
@override_settings(
|
|
|
|
MESSAGE_LEVEL=constants.DEBUG,
|
|
|
|
TEMPLATES=[{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
}],
|
|
|
|
)
|
2011-04-07 22:01:23 +00:00
|
|
|
def test_middleware_disabled(self):
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
2016-10-27 07:53:39 +00:00
|
|
|
When the middleware is disabled, an exception is raised when one
|
|
|
|
attempts to store a message.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
2013-12-23 09:37:34 +00:00
|
|
|
data = {
|
|
|
|
'messages': ['Test message %d' % x for x in range(5)],
|
|
|
|
}
|
2014-06-03 11:30:14 +00:00
|
|
|
reverse('show_message')
|
2013-12-23 09:37:34 +00:00
|
|
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
2014-06-03 11:30:14 +00:00
|
|
|
add_url = reverse('add_message', args=(level,))
|
2016-01-17 11:26:39 +00:00
|
|
|
with self.assertRaises(MessageFailure):
|
|
|
|
self.client.post(add_url, data, follow=True)
|
2013-12-23 09:37:34 +00:00
|
|
|
|
|
|
|
@modify_settings(
|
|
|
|
INSTALLED_APPS={'remove': 'django.contrib.messages'},
|
2015-11-07 15:12:37 +00:00
|
|
|
MIDDLEWARE={'remove': 'django.contrib.messages.middleware.MessageMiddleware'},
|
2014-12-17 21:51:42 +00:00
|
|
|
)
|
|
|
|
@override_settings(
|
|
|
|
TEMPLATES=[{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
}],
|
2011-10-22 23:39:09 +00:00
|
|
|
)
|
2011-04-07 22:01:23 +00:00
|
|
|
def test_middleware_disabled_fail_silently(self):
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
2016-10-27 07:53:39 +00:00
|
|
|
When the middleware is disabled, an exception is not raised
|
2018-01-12 14:05:16 +00:00
|
|
|
if 'fail_silently' is True.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
2013-12-23 09:37:34 +00:00
|
|
|
data = {
|
|
|
|
'messages': ['Test message %d' % x for x in range(5)],
|
|
|
|
'fail_silently': True,
|
|
|
|
}
|
2014-06-03 11:30:14 +00:00
|
|
|
show_url = reverse('show_message')
|
2013-12-23 09:37:34 +00:00
|
|
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
2014-06-03 11:30:14 +00:00
|
|
|
add_url = reverse('add_message', args=(level,))
|
2013-12-23 09:37:34 +00:00
|
|
|
response = self.client.post(add_url, data, follow=True)
|
|
|
|
self.assertRedirects(response, show_url)
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertNotIn('messages', response.context)
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def stored_messages_count(self, storage, response):
|
|
|
|
"""
|
2017-01-05 14:23:39 +00:00
|
|
|
Return the number of messages being stored after a
|
2009-12-09 16:57:23 +00:00
|
|
|
``storage.update()`` call.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError('This method must be set by a subclass.')
|
|
|
|
|
|
|
|
def test_get(self):
|
|
|
|
raise NotImplementedError('This method must be set by a subclass.')
|
|
|
|
|
|
|
|
def get_existing_storage(self):
|
2017-01-05 14:23:39 +00:00
|
|
|
return self.get_storage([
|
|
|
|
Message(constants.INFO, 'Test message 1'),
|
|
|
|
Message(constants.INFO, 'Test message 2', extra_tags='tag'),
|
|
|
|
])
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def test_existing_read(self):
|
|
|
|
"""
|
2016-10-27 07:53:39 +00:00
|
|
|
Reading the existing storage doesn't cause the data to be lost.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
|
|
|
storage = self.get_existing_storage()
|
|
|
|
self.assertFalse(storage.used)
|
|
|
|
# After iterating the storage engine directly, the used flag is set.
|
|
|
|
data = list(storage)
|
2011-03-03 15:04:39 +00:00
|
|
|
self.assertTrue(storage.used)
|
2009-12-09 16:57:23 +00:00
|
|
|
# The data does not disappear because it has been iterated.
|
|
|
|
self.assertEqual(data, list(storage))
|
|
|
|
|
|
|
|
def test_existing_add(self):
|
|
|
|
storage = self.get_existing_storage()
|
|
|
|
self.assertFalse(storage.added_new)
|
|
|
|
storage.add(constants.INFO, 'Test message 3')
|
2011-03-03 15:04:39 +00:00
|
|
|
self.assertTrue(storage.added_new)
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
def test_default_level(self):
|
2010-01-12 02:41:57 +00:00
|
|
|
# get_level works even with no storage on the request.
|
|
|
|
request = self.get_request()
|
|
|
|
self.assertEqual(get_level(request), constants.INFO)
|
|
|
|
|
|
|
|
# get_level returns the default level if it hasn't been set.
|
2009-12-09 16:57:23 +00:00
|
|
|
storage = self.get_storage()
|
2010-01-12 02:41:57 +00:00
|
|
|
request._messages = storage
|
|
|
|
self.assertEqual(get_level(request), constants.INFO)
|
|
|
|
|
|
|
|
# Only messages of sufficient level get recorded.
|
2009-12-09 16:57:23 +00:00
|
|
|
add_level_messages(storage)
|
|
|
|
self.assertEqual(len(storage), 5)
|
|
|
|
|
|
|
|
def test_low_level(self):
|
2010-01-12 02:41:57 +00:00
|
|
|
request = self.get_request()
|
|
|
|
storage = self.storage_class(request)
|
|
|
|
request._messages = storage
|
|
|
|
|
2011-03-03 15:04:39 +00:00
|
|
|
self.assertTrue(set_level(request, 5))
|
2010-01-12 02:41:57 +00:00
|
|
|
self.assertEqual(get_level(request), 5)
|
|
|
|
|
2009-12-09 16:57:23 +00:00
|
|
|
add_level_messages(storage)
|
|
|
|
self.assertEqual(len(storage), 6)
|
|
|
|
|
|
|
|
def test_high_level(self):
|
2010-01-12 02:41:57 +00:00
|
|
|
request = self.get_request()
|
|
|
|
storage = self.storage_class(request)
|
|
|
|
request._messages = storage
|
|
|
|
|
2011-03-03 15:04:39 +00:00
|
|
|
self.assertTrue(set_level(request, 30))
|
2010-01-12 02:41:57 +00:00
|
|
|
self.assertEqual(get_level(request), 30)
|
|
|
|
|
2009-12-09 16:57:23 +00:00
|
|
|
add_level_messages(storage)
|
|
|
|
self.assertEqual(len(storage), 2)
|
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
@override_settings(MESSAGE_LEVEL=29)
|
2009-12-09 16:57:23 +00:00
|
|
|
def test_settings_level(self):
|
2010-01-12 02:41:57 +00:00
|
|
|
request = self.get_request()
|
|
|
|
storage = self.storage_class(request)
|
|
|
|
|
|
|
|
self.assertEqual(get_level(request), 29)
|
|
|
|
|
2009-12-09 16:57:23 +00:00
|
|
|
add_level_messages(storage)
|
|
|
|
self.assertEqual(len(storage), 3)
|
|
|
|
|
|
|
|
def test_tags(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
storage.level = 0
|
|
|
|
add_level_messages(storage)
|
2017-05-10 20:38:46 +00:00
|
|
|
storage.add(constants.INFO, 'A generic info message', extra_tags=None)
|
2009-12-09 16:57:23 +00:00
|
|
|
tags = [msg.tags for msg in storage]
|
2017-05-10 20:38:46 +00:00
|
|
|
self.assertEqual(tags, ['info', '', 'extra-tag debug', 'warning', 'error', 'success', 'info'])
|
2009-12-09 16:57:23 +00:00
|
|
|
|
2013-11-07 15:50:51 +00:00
|
|
|
def test_level_tag(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
storage.level = 0
|
|
|
|
add_level_messages(storage)
|
|
|
|
tags = [msg.level_tag for msg in storage]
|
2016-04-08 02:04:45 +00:00
|
|
|
self.assertEqual(tags, ['info', '', 'debug', 'warning', 'error', 'success'])
|
2013-11-07 15:50:51 +00:00
|
|
|
|
2011-10-22 23:39:09 +00:00
|
|
|
@override_settings_tags(MESSAGE_TAGS={
|
2013-10-19 23:33:10 +00:00
|
|
|
constants.INFO: 'info',
|
|
|
|
constants.DEBUG: '',
|
|
|
|
constants.WARNING: '',
|
|
|
|
constants.ERROR: 'bad',
|
|
|
|
29: 'custom',
|
2017-01-05 14:23:39 +00:00
|
|
|
})
|
2011-10-22 23:39:09 +00:00
|
|
|
def test_custom_tags(self):
|
|
|
|
storage = self.get_storage()
|
|
|
|
storage.level = 0
|
|
|
|
add_level_messages(storage)
|
|
|
|
tags = [msg.tags for msg in storage]
|
2016-04-08 02:04:45 +00:00
|
|
|
self.assertEqual(tags, ['info', 'custom', 'extra-tag', '', 'bad', 'success'])
|