mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
Regression test for issue 6341
Ensures that the UniqueFor[Date,Month,Year]Validator classes do not raise errors when a serializer is partially updated without the fields with the uniqueness constraint.
This commit is contained in:
parent
86aa7768a7
commit
49984b06dc
|
@ -582,6 +582,13 @@ class ValidatorsTests(TestCase):
|
|||
with pytest.raises(ValidationError):
|
||||
validator.enforce_required_fields(attrs)
|
||||
|
||||
def test_validator_passes_with_instance(self):
|
||||
validator = BaseUniqueForValidator(queryset=object(), field='foo',
|
||||
date_field='bar')
|
||||
validator.instance = object()
|
||||
|
||||
assert validator.enforce_required_fields({}) is None
|
||||
|
||||
def test_validator_raises_error_when_abstract_method_called(self):
|
||||
validator = BaseUniqueForValidator(queryset=object(), field='foo',
|
||||
date_field='bar')
|
||||
|
|
Loading…
Reference in New Issue
Block a user