Used assertRaisesMessage() to test Django's error messages.

This commit is contained in:
Mads Jensen 2017-05-28 21:37:21 +02:00 committed by Tim Graham
parent 38988f289f
commit a51c4de194
69 changed files with 448 additions and 173 deletions

View file

@ -105,5 +105,10 @@ class TestMiscFinder(SimpleTestCase):
@override_settings(MEDIA_ROOT='')
def test_location_empty(self):
with self.assertRaises(ImproperlyConfigured):
msg = (
"The storage backend of the staticfiles finder "
"<class 'django.contrib.staticfiles.finders.DefaultStorageFinder'> "
"doesn't have a valid location."
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
finders.DefaultStorageFinder()