diff options
| author | Tim Graham <timograham@gmail.com> | 2016-12-31 12:30:29 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-17 20:52:04 -0500 |
| commit | 9d0e8c1e7f479dd4b414ffb4179295671bf673a6 (patch) | |
| tree | bdfafffe83623cb5fdc2156b0435d45dbf6d097a /tests | |
| parent | 169178265249949300df8288d8ebd048613f2205 (diff) | |
Refs #26320 -- Removed implicit OneToOnField parent_link per deprecation timeline.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/invalid_models_tests/test_models.py | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py index 78f2164ed5..662035af75 100644 --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -2,11 +2,11 @@ from __future__ import unicode_literals import unittest -import warnings from django.conf import settings from django.core.checks import Error from django.core.checks.model_checks import _check_lazy_references +from django.core.exceptions import ImproperlyConfigured from django.db import connections, models from django.db.models.signals import post_init from django.test import SimpleTestCase @@ -783,26 +783,14 @@ class OtherModelTests(SimpleTestCase): self.assertEqual(errors, expected) def test_missing_parent_link(self): - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') - + msg = 'Add parent_link=True to invalid_models_tests.ParkingLot.parent.' + with self.assertRaisesMessage(ImproperlyConfigured, msg): class Place(models.Model): pass class ParkingLot(Place): - # In lieu of any other connector, an existing OneToOneField will be - # promoted to the primary key. parent = models.OneToOneField(Place, models.CASCADE) - self.assertEqual(len(warns), 1) - msg = str(warns[0].message) - self.assertEqual( - msg, - 'Add parent_link=True to invalid_models_tests.ParkingLot.parent ' - 'as an implicit link is deprecated.' - ) - self.assertEqual(ParkingLot._meta.pk.name, 'parent') - def test_m2m_table_name_clash(self): class Foo(models.Model): bar = models.ManyToManyField('Bar', db_table='myapp_bar') |
