Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webapp/polls/tests/structure_tests.py
diff options
context:
space:
mode:
authorRogelio Mita <rogeliomita@activitycentral.com>2013-09-12 17:06:13 (GMT)
committer Rogelio Mita <rogeliomita@activitycentral.com>2013-09-12 17:06:13 (GMT)
commit45e952392e740da72018cb413591e0a09c50c65d (patch)
treee5a2940a3b6d04b567559c8f8688e1769d00c9c9 /webapp/polls/tests/structure_tests.py
parent713607e49509c1068397420e4d31615ae5218321 (diff)
Better checking for image options
Diffstat (limited to 'webapp/polls/tests/structure_tests.py')
-rw-r--r--webapp/polls/tests/structure_tests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py
index 4f28dd5..e7ee213 100644
--- a/webapp/polls/tests/structure_tests.py
+++ b/webapp/polls/tests/structure_tests.py
@@ -2,6 +2,7 @@
from polls.models import Poll, Group, Field, Structure
from utils.test import MongoTestCase, mock_in_memory_image
+from polls.tests.poll_tests import MockImageFileInterface
class StructureTests(MongoTestCase):
@@ -284,3 +285,34 @@ class StructureTests(MongoTestCase):
self.assertEqual(
img_name, structure.groups[0].fields[0].get_img_name())
+
+ def test_get_img_options(self):
+ poll = Poll({"name": "poll name"})
+ poll_id = poll.save()
+ poll = poll.get(poll_id)
+ img = "img"
+ data = {
+ 'groups': {
+ '0': {
+ 'name': "group name",
+ 'fields': {
+ '0': {
+ 'name': "field_0_0",
+ 'widget_type': Field.ImageCheckBox,
+ 'options': {
+ '131212': {
+ 'img': MockImageFileInterface(),
+ 'text': "text",
+ 'order': 0
+ }
+ },
+ 'img': img
+ }
+ }
+ }
+ }
+ }
+
+ structure = Structure(data=data, poll=poll)
+
+ self.assertEqual(1, len(structure.get_image_options()))