diff options
| author | Tim Graham <timograham@gmail.com> | 2014-11-13 17:35:33 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-11-13 20:12:29 +0100 |
| commit | c24a2e6cbd391c0d6359fce00e6390de9af9d2d0 (patch) | |
| tree | 12eb540200eb421eb1226494bfd687191d757987 /tests/check_framework | |
| parent | d5a109f6e6684b2ea8028af5c57f4257872d11aa (diff) | |
Fixed #23765 -- Removed BooleanField default check which often yielded false positives.
Diffstat (limited to 'tests/check_framework')
| -rw-r--r-- | tests/check_framework/models.py | 5 | ||||
| -rw-r--r-- | tests/check_framework/tests.py | 30 |
2 files changed, 1 insertions, 34 deletions
diff --git a/tests/check_framework/models.py b/tests/check_framework/models.py index f091783098..3b17332411 100644 --- a/tests/check_framework/models.py +++ b/tests/check_framework/models.py @@ -7,8 +7,3 @@ from django.db import models class SimpleModel(models.Model): field = models.IntegerField() manager = models.manager.Manager() - - -class Book(models.Model): - title = models.CharField(max_length=250) - is_published = models.BooleanField(default=False) diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py index 43b579d383..db06c138da 100644 --- a/tests/check_framework/tests.py +++ b/tests/check_framework/tests.py @@ -10,17 +10,15 @@ from django.core import checks from django.core.checks import Error, Warning from django.core.checks.model_checks import check_all_models from django.core.checks.registry import CheckRegistry -from django.core.checks.compatibility.django_1_6_0 import check_1_6_compatibility from django.core.checks.compatibility.django_1_7_0 import check_1_7_compatibility from django.core.management.base import CommandError from django.core.management import call_command from django.db import models -from django.db.models.fields import NOT_PROVIDED from django.test import TestCase from django.test.utils import override_settings, override_system_checks from django.utils.encoding import force_text -from .models import SimpleModel, Book +from .models import SimpleModel class DummyObj(object): @@ -114,32 +112,6 @@ class MessageTests(TestCase): self.assertEqual(force_text(e), expected) -class Django_1_6_0_CompatibilityChecks(TestCase): - - @override_settings(TEST_RUNNER='myapp.test.CustomRunner') - def test_boolean_field_default_value(self): - # We patch the field's default value to trigger the warning - boolean_field = Book._meta.get_field('is_published') - old_default = boolean_field.default - try: - boolean_field.default = NOT_PROVIDED - errors = check_1_6_compatibility() - expected = [ - checks.Warning( - 'BooleanField does not have a default value.', - hint=('Django 1.6 changed the default value of BooleanField from False to None. ' - 'See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield ' - 'for more information.'), - obj=boolean_field, - id='1_6.W002', - ) - ] - self.assertEqual(errors, expected) - finally: - # Restore the ``default`` - boolean_field.default = old_default - - class Django_1_7_0_CompatibilityChecks(TestCase): @override_settings(MIDDLEWARE_CLASSES=('django.contrib.sessions.middleware.SessionMiddleware',)) |
