diff options
| author | Anubhav Joshi <anubhav9042@gmail.com> | 2014-07-02 10:13:07 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-07-02 13:01:36 -0400 |
| commit | 10e83d48a3b199f9c8c73882be1ded5016f86a1a (patch) | |
| tree | c4ed0078e5c2dbe51e0ffdd01c9f7388ef036e25 /tests/validation/tests.py | |
| parent | 27ee608b5557c3cd18aab6a61f854a0f6c18f3df (diff) | |
Fixed #22935 -- Changed ForeignKey.default_error_messages['invalid'] to refer to correct field.
Thanks Tim Graham for suggestion and review.
Diffstat (limited to 'tests/validation/tests.py')
| -rw-r--r-- | tests/validation/tests.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/validation/tests.py b/tests/validation/tests.py index 6122444e3d..e1cfd64937 100644 --- a/tests/validation/tests.py +++ b/tests/validation/tests.py @@ -25,7 +25,12 @@ class BaseModelValidationTests(ValidationTestCase): def test_wrong_FK_value_raises_error(self): mtv = ModelToValidate(number=10, name='Some Name', parent_id=3) - self.assertFailsValidation(mtv.full_clean, ['parent']) + self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'parent', + ['model to validate instance with id %r does not exist.' % mtv.parent_id]) + + mtv = ModelToValidate(number=10, name='Some Name', ufm_id='Some Name') + self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'ufm', + ["unique fields model instance with unique_charfield %r does not exist." % mtv.name]) def test_correct_FK_value_validates(self): parent = ModelToValidate.objects.create(number=10, name='Some Name') |
