diff options
author | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-07-31 00:45:17 (GMT) |
---|---|---|
committer | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-07-31 02:18:06 (GMT) |
commit | 4cf5c2b581d12dd8c23efcf7c7b667e9e4efde80 (patch) | |
tree | 82a38aea5c67c165acbfb140d35523168cd8a655 /webapp/polls/tests/structure_tests.py | |
parent | 9b17f03e8ab9e40e95b87f595b8c81bea1272fcb (diff) |
Save image for a field
Diffstat (limited to 'webapp/polls/tests/structure_tests.py')
-rw-r--r-- | webapp/polls/tests/structure_tests.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py index c4081fb..cd10d56 100644 --- a/webapp/polls/tests/structure_tests.py +++ b/webapp/polls/tests/structure_tests.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- from polls.models import Poll, Group, Field, Structure -from utils.test import MongoTestCase +from utils.test import MongoTestCase, mock_in_memory_image class StructureTests(MongoTestCase): @@ -252,14 +252,16 @@ class StructureTests(MongoTestCase): self.assertEqual(img, structure.groups[0].fields[0].img) def test_save_field_image(self): - img = "soy una imagen de verdad!!" + img_name = "img_test.jpg" + img = mock_in_memory_image(name=img_name) poll = self.poll data = self.data - data['groups']['0']['fields']['0']['img'] = img + data['groups']['0']['fields']['0']['uploaded_file'] = img structure = Structure(data=data, poll=poll) s_id = structure.save() structure = Structure.get(id=s_id) - self.assertEqual(img, structure.groups[0].fields[0].img) + self.assertEqual( + img_name, structure.groups[0].fields[0].get_img_name()) |