aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/relations.py
diff options
context:
space:
mode:
authorFernando Rocha2013-01-30 09:09:17 -0300
committerFernando Rocha2013-01-30 09:22:36 -0300
commit41364b3be0536a606d9b41d3792c2e562b860360 (patch)
tree843c887b4e93d35f5bcebd352bdd4caf7b5919ca /rest_framework/tests/relations.py
parentfceacd830fcd3b67425dafd5b0e6dcc5b285b6ca (diff)
downloaddjango-rest-framework-41364b3be0536a606d9b41d3792c2e562b860360.tar.bz2
Added regretion test for issue #632
Signed-off-by: Fernando Rocha <fernandogrd@gmail.com>
Diffstat (limited to 'rest_framework/tests/relations.py')
-rw-r--r--rest_framework/tests/relations.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/rest_framework/tests/relations.py b/rest_framework/tests/relations.py
index 91daea8a..edc85f9e 100644
--- a/rest_framework/tests/relations.py
+++ b/rest_framework/tests/relations.py
@@ -31,3 +31,17 @@ class FieldTests(TestCase):
field = serializers.SlugRelatedField(queryset=NullModel.objects.all(), slug_field='pk')
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'], [])