summaryrefslogtreecommitdiff
path: root/tests/model_formsets
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-11-05 01:40:41 -0800
committerGitHub <noreply@github.com>2020-11-05 10:40:41 +0100
commit859cd7c6b43bf70e2852eda10f635c70feeb397f (patch)
tree648e43ff9d72edcf162583a123fbdfe047fd0f02 /tests/model_formsets
parent76181308fb02e67794d0cc1471766a5d7e4c877e (diff)
downloaddjango-859cd7c6b43bf70e2852eda10f635c70feeb397f.tar.gz
Fixed #22276 -- Fixed crash when formset management form is invalid.
Co-authored-by: Patryk Zawadzki <patrys@room-303.com>
Diffstat (limited to 'tests/model_formsets')
-rw-r--r--tests/model_formsets/tests.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py
index aaf76fa7ec..9c06d45339 100644
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -4,7 +4,7 @@ from datetime import date
from decimal import Decimal
from django import forms
-from django.core.exceptions import ImproperlyConfigured, ValidationError
+from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.forms.models import (
BaseModelFormSet, _get_foreign_key, inlineformset_factory,
@@ -1783,11 +1783,10 @@ class ModelFormsetTest(TestCase):
[{'id': ['Select a valid choice. That choice is not one of the available choices.']}],
)
- def test_initial_form_count_empty_data_raises_validation_error(self):
+ def test_initial_form_count_empty_data(self):
AuthorFormSet = modelformset_factory(Author, fields='__all__')
- msg = 'ManagementForm data is missing or has been tampered with'
- with self.assertRaisesMessage(ValidationError, msg):
- AuthorFormSet({}).initial_form_count()
+ formset = AuthorFormSet({})
+ self.assertEqual(formset.initial_form_count(), 0)
class TestModelFormsetOverridesTroughFormMeta(TestCase):