Fix contrib.messages tests for discovery.

This commit is contained in:
Carl Meyer 2013-04-02 21:42:00 -06:00
parent c250f9c99b
commit 7ccbe6a4fa
4 changed files with 10 additions and 8 deletions

View File

@ -5,7 +5,6 @@ from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import default_storage, base from django.contrib.messages.storage import default_storage, base
from django.contrib.messages.storage.base import Message from django.contrib.messages.storage.base import Message
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy from django.utils.translation import ugettext_lazy
from django.utils.unittest import skipIf from django.utils.unittest import skipIf
@ -43,7 +42,7 @@ class override_settings_tags(override_settings):
base.LEVEL_TAGS = self.old_level_tags base.LEVEL_TAGS = self.old_level_tags
class BaseTest(TestCase): class BaseTests(object):
storage_class = default_storage storage_class = default_storage
urls = 'django.contrib.messages.tests.urls' urls = 'django.contrib.messages.tests.urls'
levels = { levels = {

View File

@ -1,10 +1,11 @@
import json import json
from django.contrib.messages import constants from django.contrib.messages import constants
from django.contrib.messages.tests.test_base import BaseTest from django.contrib.messages.tests.base import BaseTests
from django.contrib.messages.storage.cookie import (CookieStorage, from django.contrib.messages.storage.cookie import (CookieStorage,
MessageEncoder, MessageDecoder) MessageEncoder, MessageDecoder)
from django.contrib.messages.storage.base import Message from django.contrib.messages.storage.base import Message
from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.safestring import SafeData, mark_safe from django.utils.safestring import SafeData, mark_safe
@ -41,7 +42,7 @@ def stored_cookie_messages_count(storage, response):
@override_settings(SESSION_COOKIE_DOMAIN='.example.com') @override_settings(SESSION_COOKIE_DOMAIN='.example.com')
class CookieTest(BaseTest): class CookieTest(BaseTests, TestCase):
storage_class = CookieStorage storage_class = CookieStorage
def stored_messages_count(self, storage, response): def stored_messages_count(self, storage, response):

View File

@ -1,14 +1,15 @@
from django.contrib.messages import constants from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import (FallbackStorage, from django.contrib.messages.storage.fallback import (FallbackStorage,
CookieStorage) CookieStorage)
from django.contrib.messages.tests.test_base import BaseTest from django.contrib.messages.tests.base import BaseTests
from django.contrib.messages.tests.test_cookie import (set_cookie_data, from django.contrib.messages.tests.test_cookie import (set_cookie_data,
stored_cookie_messages_count) stored_cookie_messages_count)
from django.contrib.messages.tests.test_session import (set_session_data, from django.contrib.messages.tests.test_session import (set_session_data,
stored_session_messages_count) stored_session_messages_count)
from django.test import TestCase
class FallbackTest(BaseTest): class FallbackTest(BaseTests, TestCase):
storage_class = FallbackStorage storage_class = FallbackStorage
def get_request(self): def get_request(self):

View File

@ -1,8 +1,9 @@
from django.contrib.messages import constants from django.contrib.messages import constants
from django.contrib.messages.tests.test_base import BaseTest from django.contrib.messages.tests.base import BaseTests
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.utils.safestring import SafeData, mark_safe from django.utils.safestring import SafeData, mark_safe
from django.test import TestCase
def set_session_data(storage, messages): def set_session_data(storage, messages):
@ -20,7 +21,7 @@ def stored_session_messages_count(storage):
return len(data) return len(data)
class SessionTest(BaseTest): class SessionTest(BaseTests, TestCase):
storage_class = SessionStorage storage_class = SessionStorage
def get_request(self): def get_request(self):