'Tests settings an index on an embedded document'

def test_embedded_document_index(self):

    class Date(EmbeddedDocument, ):
        year = IntField(db_field='yr')
    class BlogPost(Document, ):
        title = StringField()
        date = EmbeddedDocumentField(Date)
        meta = {'indexes': ['-date.year']}
    BlogPost.drop_collection()
    info = BlogPost.objects._collection.index_information()
    self.assertEqual(sorted(info.keys()), ['_id_', 'date.yr_-1'])
