Moved contrib.messages tests out of contrib.

This commit is contained in:
Tim Graham 2015-02-10 08:30:35 -05:00
parent fac3a34cbb
commit b3cd9e0d07
9 changed files with 12 additions and 21 deletions

View File

@ -1,7 +1,4 @@
from unittest import skipUnless
from django import http from django import http
from django.apps import apps
from django.contrib.messages import constants, get_level, set_level, utils from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS 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 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): def add_level_messages(storage):
""" """
Adds 6 messages from different levels (including a custom one) to a 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_TAGS='',
MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__, MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__,
self.storage_class.__name__), self.storage_class.__name__),

View File

@ -5,10 +5,11 @@ from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.cookie import ( from django.contrib.messages.storage.cookie import (
CookieStorage, MessageDecoder, MessageEncoder, CookieStorage, MessageDecoder, MessageEncoder,
) )
from django.contrib.messages.tests.base import BaseTests
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.utils.safestring import SafeData, mark_safe from django.utils.safestring import SafeData, mark_safe
from .base import BaseTests
def set_cookie_data(storage, messages, invalid=False, encode_empty=False): def set_cookie_data(storage, messages, invalid=False, encode_empty=False):
""" """

View File

@ -2,15 +2,12 @@ from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import ( from django.contrib.messages.storage.fallback import (
CookieStorage, FallbackStorage, 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 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): class FallbackTest(BaseTests, TestCase):
storage_class = FallbackStorage storage_class = FallbackStorage

View File

@ -1,9 +1,10 @@
from django.contrib.messages.tests.urls import ContactFormViewWithMsg
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings 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): class SuccessMessageMixinTests(TestCase):
def test_set_messages_success(self): def test_set_messages_success(self):

View File

@ -1,10 +1,11 @@
from django.contrib.messages import constants from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.session import SessionStorage from django.contrib.messages.storage.session import SessionStorage
from django.contrib.messages.tests.base import BaseTests
from django.test import TestCase from django.test import TestCase
from django.utils.safestring import SafeData, mark_safe from django.utils.safestring import SafeData, mark_safe
from .base import BaseTests
def set_session_data(storage, messages): def set_session_data(storage, messages):
""" """