Anonymous avatar Anonymous committed e28033a

Fixed #14632 -- Skip a messages test if auth app is not in INSTALLED_APPS. Thanks, gregmuellegger.

Comments (0)

Files changed (2)


 from django.test import TestCase
 from django.conf import settings
 from django.utils.translation import ugettext_lazy
+from django.utils.unittest import skipIf
 from django.contrib.messages import constants, utils, get_level, set_level
 from django.contrib.messages.api import MessageFailure
 from import default_storage, base
 from django.contrib.auth.models import User
+def skipUnlessAuthIsInstalled(func):
+    return skipIf(
+        'django.contrib.auth' not in settings.INSTALLED_APPS,
+        "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
         for msg in data['messages']:
             self.assertContains(response, msg)
+    @skipUnlessAuthIsInstalled
     def test_middleware_disabled_auth_user(self):
         Tests that the messages API successfully falls back to using


 from django.contrib.auth.models import User
 from import UserMessagesStorage,\
+from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled
 from django.contrib.messages.tests.cookie import set_cookie_data
 from django.contrib.messages.tests.fallback import FallbackTest
 from django.test import TestCase
         self.assertEqual(len(storage), 1)
         self.assertEqual(list(storage)[0].message, 'test message')
+UserMessagesTest = skipUnlessAuthIsInstalled(UserMessagesTest)
 class LegacyFallbackTest(FallbackTest, TestCase):
     storage_class = LegacyFallbackStorage
         self.assertEqual(len(storage), 2)
         self.assertEqual(list(storage)[0].message, 'user message')
         self.assertEqual(list(storage)[1], 'cookie')
+LegacyFallbackTest = skipUnlessAuthIsInstalled(LegacyFallbackTest)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.