mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-14 05:36:50 +03:00
Added regretion test for issue #632
Signed-off-by: Fernando Rocha <fernandogrd@gmail.com>
This commit is contained in:
parent
fceacd830f
commit
41364b3be0
|
@ -31,3 +31,17 @@ class FieldTests(TestCase):
|
||||||
field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk')
|
field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk')
|
||||||
self.assertRaises(serializers.ValidationError, field.from_native, '')
|
self.assertRaises(serializers.ValidationError, field.from_native, '')
|
||||||
self.assertRaises(serializers.ValidationError, field.from_native, [])
|
self.assertRaises(serializers.ValidationError, field.from_native, [])
|
||||||
|
|
||||||
|
|
||||||
|
class TestManyRelateMixin(TestCase):
|
||||||
|
def test_missing_many_to_many_related_field(self):
|
||||||
|
'''
|
||||||
|
Regression test for #632
|
||||||
|
|
||||||
|
https://github.com/tomchristie/django-rest-framework/pull/632
|
||||||
|
'''
|
||||||
|
field = serializers.ManyRelatedField(read_only=False)
|
||||||
|
|
||||||
|
into = {}
|
||||||
|
field.field_from_native({}, None, 'field_name', into)
|
||||||
|
self.assertEqual(into['field_name'], [])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user