diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-07-30 16:03:45 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-07-30 16:03:45 (GMT) |
commit | dceffa835e8b73f87ab1363d183609a6c76ea72c (patch) | |
tree | 3a3750b6546160e3486326d6ea0fbae7d505b990 | |
parent | 22fd4169dbda03de52dde2371ebd7feb05acf223 (diff) |
second impression
-rw-r--r-- | webapp/polls/models.py | 4 | ||||
-rw-r--r-- | webapp/polls/tests/structure_tests.py | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/webapp/polls/models.py b/webapp/polls/models.py index ee96cf9..7c657cb 100644 --- a/webapp/polls/models.py +++ b/webapp/polls/models.py @@ -1042,7 +1042,9 @@ class Structure(AbstractObject, ComponentStructure): if self.id: _dict.update({'_id': ObjectId(self.id)}) - # Save process -> Update if it have id, else insert + print _dict + + # Save process -> Update if it has an id, else insert structure_id = get_db().structures.save(_dict) # Removing older img options files diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py index 8c2e931..c4081fb 100644 --- a/webapp/polls/tests/structure_tests.py +++ b/webapp/polls/tests/structure_tests.py @@ -250,3 +250,16 @@ class StructureTests(MongoTestCase): structure = Structure(data=data, poll=poll) self.assertEqual(img, structure.groups[0].fields[0].img) + + def test_save_field_image(self): + img = "soy una imagen de verdad!!" + poll = self.poll + data = self.data + data['groups']['0']['fields']['0']['img'] = 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) |