'Ensure that indexes are used when meta[indexes] contains
dictionaries instead of lists.'

def test_dictionary_indexes(self):

    class BlogPost(Document, ):
        date = DateTimeField(db_field='addDate', default=datetime.now)
        category = StringField()
        tags = ListField(StringField())
        meta = {'indexes': [{'fields': ['-date'], 'unique': True, 'sparse': True}]}
    self.assertEqual([{'fields': [('addDate', (-1))], 'unique': True, 'sparse': True}], BlogPost._meta['index_specs'])
    BlogPost.drop_collection()
    info = BlogPost.objects._collection.index_information()
    self.assertEqual(len(info), 2)
    list(BlogPost.objects)
    info = BlogPost.objects._collection.index_information()
    info = [(value['key'], value.get('unique', False), value.get('sparse', False)) for (key, value) in info.iteritems()]
    self.assertTrue((([('addDate', (-1))], True, True) in info))
    BlogPost.drop_collection()
