'Ensure that uniqueness constraints are applied to fields.'

def test_unique(self):

    class BlogPost(Document, ):
        title = StringField()
        slug = StringField(unique=True)
    BlogPost.drop_collection()
    post1 = BlogPost(title='test1', slug='test')
    post1.save()
    post2 = BlogPost(title='test2', slug='test')
    self.assertRaises(NotUniqueError, post2.save)
    self.assertRaises(OperationError, post2.save)
