'Invalid many-to-many keys should throw a helpful error message. This
tests the code path where a natural many-to-many key has only a single
value.'

def test_helpful_error_message_for_many2many_natural2(self):

    test_string = '[{\n                                                "pk":    1,\n                                                "model":    "serializers.article",\n                                                "fields":    {\n                                                                "author":    1,\n                                                                "headline":    "Unknown    many    to    many",\n                                                                "pub_date":    "2014-09-15T10:35:00",\n                                                                "meta_data":    [1,    "doesnotexist"]\n                                                }\n                                },    {\n                                                "pk":    1,\n                                                "model":    "serializers.categorymetadata",\n                                                "fields":    {\n                                                                "kind":    "author",\n                                                                "name":    "meta1",\n                                                                "value":    "Agnes"\n                                                }\n                                },    {\n                                                "pk":    1,\n                                                "model":    "serializers.author",\n                                                "fields":    {\n                                                                "name":    "Agnes"\n                                                }\n                                }]'
    expected = "(serializers.article:pk=1)    field_value    was    'doesnotexist'"
    with self.assertRaisesMessage(DeserializationError, expected):
        for obj in serializers.deserialize('json', test_string, ignore=False):
            obj.save()
