Skip to content

Commit

Permalink
Added forms test (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
rozza committed May 3, 2013
1 parent d477b10 commit aa6f13c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@ class BlogPost(db.Document):

self.assertEqual(form.title.description, "Some imaginative title to set the world on fire")

def test_embedded_model_form(self):
with self.app.test_request_context('/'):
db = self.db

class Content(db.EmbeddedDocument):
text = db.StringField()
lang = db.StringField(max_length=3)

class Post(db.Document):
title = db.StringField(max_length=120, required=True)
tags = db.ListField(db.StringField(max_length=30))
content = db.EmbeddedDocumentField("Content")

PostForm = model_form(Post)
form = PostForm()
self.assertTrue("content-text" in form.content.text)


if __name__ == '__main__':
unittest.main()

0 comments on commit aa6f13c

Please sign in to comment.