mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-30 05:24:00 +03:00
More complex test case.
This commit is contained in:
parent
de899824b8
commit
caf4d36cb3
|
@ -617,9 +617,9 @@ class ModelValidationTests(TestCase):
|
||||||
second_serializer = AlbumsSerializer(data={'title': 'a'})
|
second_serializer = AlbumsSerializer(data={'title': 'a'})
|
||||||
self.assertFalse(second_serializer.is_valid())
|
self.assertFalse(second_serializer.is_valid())
|
||||||
self.assertEqual(second_serializer.errors, {'title': ['Album with this Title already exists.'],})
|
self.assertEqual(second_serializer.errors, {'title': ['Album with this Title already exists.'],})
|
||||||
third_serializer = AlbumsSerializer(data={'title': 'b', 'ref': '1'})
|
third_serializer = AlbumsSerializer(data=[{'title': 'b', 'ref': '1'}, {'title': 'c'}])
|
||||||
self.assertFalse(third_serializer.is_valid())
|
self.assertFalse(third_serializer.is_valid())
|
||||||
self.assertEqual(third_serializer.errors, {'ref': ['Album with this Ref already exists.'],})
|
self.assertEqual(third_serializer.errors, [{'ref': ['Album with this Ref already exists.']}, {}])
|
||||||
|
|
||||||
def test_foreign_key_is_null_with_partial(self):
|
def test_foreign_key_is_null_with_partial(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user