mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-23 22:49:50 +03:00
Test for missing M2M data when creating an instance
This commit is contained in:
parent
02c1b5988b
commit
5ed528d1cf
|
@ -334,6 +334,15 @@ class ManyToManyTests(TestCase):
|
||||||
self.assertEquals(instance.pk, 1)
|
self.assertEquals(instance.pk, 1)
|
||||||
self.assertEquals(list(instance.rel.all()), [])
|
self.assertEquals(list(instance.rel.all()), [])
|
||||||
|
|
||||||
|
def test_create_relationship_missing(self):
|
||||||
|
"""
|
||||||
|
Create an instance of a model with a missing ManyToMany relationship
|
||||||
|
"""
|
||||||
|
data = {}
|
||||||
|
serializer = self.serializer_class(data=data)
|
||||||
|
self.assertEqual(serializer.is_valid(), False)
|
||||||
|
|
||||||
|
|
||||||
def test_create_empty_relationship_flat_data(self):
|
def test_create_empty_relationship_flat_data(self):
|
||||||
"""
|
"""
|
||||||
Create an instance of a model with a ManyToMany relationship,
|
Create an instance of a model with a ManyToMany relationship,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user