'Ensure you can add meta data to file'

def test_complex_field_filefield(self):

    class Animal(Document, ):
        genus = StringField()
        family = StringField()
        photos = ListField(FileField())
    Animal.drop_collection()
    marmot = Animal(genus='Marmota', family='Sciuridae')
    marmot_photo = open(TEST_IMAGE_PATH, 'rb')
    photos_field = marmot._fields['photos'].field
    new_proxy = photos_field.get_proxy_obj('photos', marmot)
    new_proxy.put(marmot_photo, content_type='image/jpeg', foo='bar')
    marmot_photo.close()
    marmot.photos.append(new_proxy)
    marmot.save()
    marmot = Animal.objects.get()
    self.assertEqual(marmot.photos[0].content_type, 'image/jpeg')
    self.assertEqual(marmot.photos[0].foo, 'bar')
    self.assertEqual(marmot.photos[0].get().length, 8313)
