diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py
index 9c6132b..9a0f7fb 100644
a
|
b
|
from django import http
|
4 | 4 | from django.test import TestCase |
5 | 5 | from django.conf import settings |
6 | 6 | from django.utils.translation import ugettext_lazy |
| 7 | from django.utils.unittest import skipIf |
7 | 8 | from django.contrib.messages import constants, utils, get_level, set_level |
8 | 9 | from django.contrib.messages.api import MessageFailure |
9 | 10 | from django.contrib.messages.storage import default_storage, base |
… |
… |
from django.core.urlresolvers import reverse
|
12 | 13 | from django.contrib.auth.models import User |
13 | 14 | |
14 | 15 | |
| 16 | def skipUnlessAuthIsInstalled(func): |
| 17 | return skipIf( |
| 18 | 'django.contrib.auth' not in settings.INSTALLED_APPS, |
| 19 | "django.contrib.auth isn't installed")(func) |
| 20 | |
| 21 | |
15 | 22 | def add_level_messages(storage): |
16 | 23 | """ |
17 | 24 | Adds 6 messages from different levels (including a custom one) to a storage |
… |
… |
class BaseTest(TestCase):
|
196 | 203 | for msg in data['messages']: |
197 | 204 | self.assertContains(response, msg) |
198 | 205 | |
| 206 | @skipUnlessAuthIsInstalled |
199 | 207 | def test_middleware_disabled_auth_user(self): |
200 | 208 | """ |
201 | 209 | Tests that the messages API successfully falls back to using |
diff --git a/django/contrib/messages/tests/session.py b/django/contrib/messages/tests/session.py
index 741f531..44fa96c 100644
a
|
b
|
|
1 | 1 | from django.contrib.messages.tests.base import BaseTest |
| 2 | from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled |
2 | 3 | from django.contrib.messages.storage.session import SessionStorage |
3 | 4 | |
4 | 5 | |
diff --git a/django/contrib/messages/tests/user_messages.py b/django/contrib/messages/tests/user_messages.py
index 8d7aeb7..dad552c 100644
a
|
b
|
from django import http
|
2 | 2 | from django.contrib.auth.models import User |
3 | 3 | from django.contrib.messages.storage.user_messages import UserMessagesStorage,\ |
4 | 4 | LegacyFallbackStorage |
| 5 | from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled |
5 | 6 | from django.contrib.messages.tests.cookie import set_cookie_data |
6 | 7 | from django.contrib.messages.tests.fallback import FallbackTest |
7 | 8 | from django.test import TestCase |
… |
… |
class UserMessagesTest(TestCase):
|
30 | 31 | self.assertEqual(len(storage), 1) |
31 | 32 | self.assertEqual(list(storage)[0].message, 'test message') |
32 | 33 | |
| 34 | UserMessagesTest = skipUnlessAuthIsInstalled(UserMessagesTest) |
| 35 | |
33 | 36 | |
34 | 37 | class LegacyFallbackTest(FallbackTest, TestCase): |
35 | 38 | storage_class = LegacyFallbackStorage |
… |
… |
class LegacyFallbackTest(FallbackTest, TestCase):
|
63 | 66 | self.assertEqual(len(storage), 2) |
64 | 67 | self.assertEqual(list(storage)[0].message, 'user message') |
65 | 68 | self.assertEqual(list(storage)[1], 'cookie') |
| 69 | |
| 70 | LegacyFallbackTest = skipUnlessAuthIsInstalled(LegacyFallbackTest) |