'Ensure fields with document choices validate given an invalid choice.
This should throw a ValidationError exception.'

def test_choices_validation_documents_invalid(self):

    class UserComments(EmbeddedDocument, ):
        author = StringField()
        message = StringField()
    class ModeratorComments(EmbeddedDocument, ):
        author = StringField()
        message = StringField()
    class BlogPost(Document, ):
        comments = ListField(GenericEmbeddedDocumentField(choices=(UserComments,)))
    post = BlogPost(comments=[ModeratorComments(author='mod1', message='message1')])
    self.assertRaises(ValidationError, post.save)
    post = BlogPost(comments=[ModeratorComments(author='mod1', message='message1'), UserComments(author='user2', message='message2')])
    self.assertRaises(ValidationError, post.save)
