'Invalid foreign keys with a natural key should throw a helpful error
message, such as what the failing key is.'

def test_helpful_error_message_for_foreign_keys(self):

    test_string = '[{\n                                                "pk":    1,\n                                                "model":    "serializers.category",\n                                                "fields":    {\n                                                                "name":    "Unknown    foreign    key",\n                                                                "meta_data":    [\n                                                                                "doesnotexist",\n                                                                                "metadata"\n                                                                ]\n                                                }\n                                }]'
    key = ['doesnotexist', 'metadata']
    expected = ("(serializers.category:pk=1)    field_value    was    '%r'" % key)
    with self.assertRaisesMessage(DeserializationError, expected):
        list(serializers.deserialize('json', test_string))
