aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_validators.py
diff options
context:
space:
mode:
authorTom Christie2014-11-10 12:21:27 +0000
committerTom Christie2014-11-10 12:21:27 +0000
commitf387cd89da55ef88fcac504f5795ea9b591f3fba (patch)
tree3c927d172e0ea18c65f6afd2360c308e286c13a3 /tests/test_validators.py
parent93633c297c69a1eefda5e153553c4f021cf10bd8 (diff)
downloaddjango-rest-framework-f387cd89da55ef88fcac504f5795ea9b591f3fba.tar.bz2
Uniqueness constraints imply a forced 'required=True'. Refs #1945
Diffstat (limited to 'tests/test_validators.py')
-rw-r--r--tests/test_validators.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_validators.py b/tests/test_validators.py
index e6e0b23a..86614b10 100644
--- a/tests/test_validators.py
+++ b/tests/test_validators.py
@@ -134,6 +134,17 @@ class TestUniquenessTogetherValidation(TestCase):
'position': 1
}
+ def test_unique_together_is_required(self):
+ """
+ In a unique together validation, all fields are required.
+ """
+ data = {'position': 2}
+ serializer = UniquenessTogetherSerializer(data=data, partial=True)
+ assert not serializer.is_valid()
+ assert serializer.errors == {
+ 'race_name': ['This field is required.']
+ }
+
def test_ignore_excluded_fields(self):
"""
When model fields are not included in a serializer, then uniqueness