[1.8.x] Moved contrib.messages tests out of contrib.
Backport of b3cd9e0d07
from master
This commit is contained in:
parent
10fdd2fc1d
commit
bbe7964185
|
@ -1,7 +1,4 @@
|
|||
from unittest import skipUnless
|
||||
|
||||
from django import http
|
||||
from django.apps import apps
|
||||
from django.contrib.messages import constants, get_level, set_level, utils
|
||||
from django.contrib.messages.api import MessageFailure
|
||||
from django.contrib.messages.constants import DEFAULT_LEVELS
|
||||
|
@ -12,12 +9,6 @@ from django.test import modify_settings, override_settings
|
|||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
|
||||
def skipUnlessAuthIsInstalled(func):
|
||||
return skipUnless(
|
||||
apps.is_installed('django.contrib.auth'),
|
||||
"django.contrib.auth isn't installed")(func)
|
||||
|
||||
|
||||
def add_level_messages(storage):
|
||||
"""
|
||||
Adds 6 messages from different levels (including a custom one) to a storage
|
||||
|
@ -68,7 +59,7 @@ class BaseTests(object):
|
|||
),
|
||||
},
|
||||
}],
|
||||
ROOT_URLCONF='django.contrib.messages.tests.urls',
|
||||
ROOT_URLCONF='messages_tests.urls',
|
||||
MESSAGE_TAGS='',
|
||||
MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__,
|
||||
self.storage_class.__name__),
|
|
@ -5,10 +5,11 @@ from django.contrib.messages.storage.base import Message
|
|||
from django.contrib.messages.storage.cookie import (
|
||||
CookieStorage, MessageDecoder, MessageEncoder,
|
||||
)
|
||||
from django.contrib.messages.tests.base import BaseTests
|
||||
from django.test import TestCase, override_settings
|
||||
from django.utils.safestring import SafeData, mark_safe
|
||||
|
||||
from .base import BaseTests
|
||||
|
||||
|
||||
def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
|
||||
"""
|
|
@ -2,15 +2,12 @@ from django.contrib.messages import constants
|
|||
from django.contrib.messages.storage.fallback import (
|
||||
CookieStorage, FallbackStorage,
|
||||
)
|
||||
from django.contrib.messages.tests.base import BaseTests
|
||||
from django.contrib.messages.tests.test_cookie import (
|
||||
set_cookie_data, stored_cookie_messages_count,
|
||||
)
|
||||
from django.contrib.messages.tests.test_session import (
|
||||
set_session_data, stored_session_messages_count,
|
||||
)
|
||||
from django.test import TestCase
|
||||
|
||||
from .base import BaseTests
|
||||
from .test_cookie import set_cookie_data, stored_cookie_messages_count
|
||||
from .test_session import set_session_data, stored_session_messages_count
|
||||
|
||||
|
||||
class FallbackTest(BaseTests, TestCase):
|
||||
storage_class = FallbackStorage
|
|
@ -1,9 +1,10 @@
|
|||
from django.contrib.messages.tests.urls import ContactFormViewWithMsg
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase, override_settings
|
||||
|
||||
from .urls import ContactFormViewWithMsg
|
||||
|
||||
@override_settings(ROOT_URLCONF='django.contrib.messages.tests.urls')
|
||||
|
||||
@override_settings(ROOT_URLCONF='messages_tests.urls')
|
||||
class SuccessMessageMixinTests(TestCase):
|
||||
|
||||
def test_set_messages_success(self):
|
|
@ -1,10 +1,11 @@
|
|||
from django.contrib.messages import constants
|
||||
from django.contrib.messages.storage.base import Message
|
||||
from django.contrib.messages.storage.session import SessionStorage
|
||||
from django.contrib.messages.tests.base import BaseTests
|
||||
from django.test import TestCase
|
||||
from django.utils.safestring import SafeData, mark_safe
|
||||
|
||||
from .base import BaseTests
|
||||
|
||||
|
||||
def set_session_data(storage, messages):
|
||||
"""
|
Loading…
Reference in New Issue