mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
This commit is contained in:
committed by
Tim Graham
parent
7ba040de77
commit
704443acac
11
tests/fixtures/tests.py
vendored
11
tests/fixtures/tests.py
vendored
@@ -495,16 +495,9 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||
parent.
|
||||
"""
|
||||
ProxySpy.objects.create(name='Paul')
|
||||
|
||||
with warnings.catch_warnings(record=True) as warning_list:
|
||||
warnings.simplefilter('always')
|
||||
msg = "fixtures.ProxySpy is a proxy model and won't be serialized."
|
||||
with self.assertWarnsMessage(ProxyModelWarning, msg):
|
||||
self._dumpdata_assert(['fixtures.ProxySpy'], '[]')
|
||||
warning = warning_list.pop()
|
||||
self.assertEqual(warning.category, ProxyModelWarning)
|
||||
self.assertEqual(
|
||||
str(warning.message),
|
||||
"fixtures.ProxySpy is a proxy model and won't be serialized."
|
||||
)
|
||||
|
||||
def test_dumpdata_proxy_with_concrete(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user