diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 20:52:19 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 20:52:19 (GMT) |
commit | da5e3fa249efd68162278ff80f66b7137e83dc0a (patch) | |
tree | b0243fece825b05423e8fb4c94c05860cbf6721f /webapp | |
parent | 9c437f5215b78312bd21f3e740c7a9869acb1a44 (diff) |
copy test_save to his own test class
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/polls/tests/structure_tests.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py index ebb0f7e..9e499a8 100644 --- a/webapp/polls/tests/structure_tests.py +++ b/webapp/polls/tests/structure_tests.py @@ -413,3 +413,38 @@ class UploadOptionImagesTest(MongoTestCase): def tearDown(self): remove_option_images_dir() + + +class SaveStructureTest(MongoTestCase): + + def setUp(self): + poll = Poll(data={'name': 'name'}) + poll_id = poll.save() + + self.poll = Poll.get(id=poll_id) + + self.data = { + 'poll_id': 'POLL_ID', + 'groups': { + '0': { + 'name': 'group_0', + 'fields': { + '0': { + 'widget_type': Field.TextInput, + 'name': 'field_0_0' + } + } + } + } + } + + def test_save(self): + + structure = Structure(data=self.data) + + self.assertRaises(structure.ValidationError, structure.save) + + structure = Structure(data=self.data, poll=self.poll) + structure.save() + + self.assertEqual(1, self.db.structures.count()) |