diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-02-04 21:58:07 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-02-07 12:46:23 +0100 |
commit | fc4f45ebdccd87f140f39bebed897053c7f345c5 (patch) | |
tree | 0080670fe0c04124b7b2e15766fac2d73a00f164 /tests/admin_autodiscover | |
parent | 71756bdfed5029bd14dce8cb3c5629efc4be55ac (diff) | |
download | django-fc4f45ebdccd87f140f39bebed897053c7f345c5.tar.gz |
Used assertRaisesMessage() in various tests.
Diffstat (limited to 'tests/admin_autodiscover')
-rw-r--r-- | tests/admin_autodiscover/tests.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/admin_autodiscover/tests.py b/tests/admin_autodiscover/tests.py index af5aebcd7f..b15060ade8 100644 --- a/tests/admin_autodiscover/tests.py +++ b/tests/admin_autodiscover/tests.py @@ -1,21 +1,17 @@ -from unittest import TestCase - from django.contrib import admin +from django.test import SimpleTestCase -class AdminAutoDiscoverTests(TestCase): +class AdminAutoDiscoverTests(SimpleTestCase): """ Test for bug #8245 - don't raise an AlreadyRegistered exception when using autodiscover() and an admin.py module contains an error. """ def test_double_call_autodiscover(self): # The first time autodiscover is called, we should get our real error. - with self.assertRaises(Exception) as cm: + with self.assertRaisesMessage(Exception, 'Bad admin module'): admin.autodiscover() - self.assertEqual(str(cm.exception), "Bad admin module") - # Calling autodiscover again should raise the very same error it did # the first time, not an AlreadyRegistered error. - with self.assertRaises(Exception) as cm: + with self.assertRaisesMessage(Exception, 'Bad admin module'): admin.autodiscover() - self.assertEqual(str(cm.exception), "Bad admin module") |