diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 21:56:20 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 21:56:20 (GMT) |
commit | c2231e95bab8c5a9d2d63ded8ccec58bdec1977f (patch) | |
tree | e0c2bbba9848eee89bdadd6aced8c4629f203682 /webapp/polls/tests/structure_tests.py | |
parent | b118f6619c97906106edb9bca4162b0fe1898bb5 (diff) |
check if structure is not read only before save
Diffstat (limited to 'webapp/polls/tests/structure_tests.py')
-rw-r--r-- | webapp/polls/tests/structure_tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py index a7857f4..aeb8702 100644 --- a/webapp/polls/tests/structure_tests.py +++ b/webapp/polls/tests/structure_tests.py @@ -7,6 +7,7 @@ from mock import Mock from utils.test import (MongoTestCase, mock_in_memory_image, remove_option_images_dir) from polls.tests.poll_tests import MockImageFileInterface +from polls.exceptions import ReadOnly class StructureTests(MongoTestCase): @@ -434,3 +435,9 @@ class SaveStructureTest(MongoTestCase): structure = Structure(data=self.data, poll=self.poll) structure.save() self.assertEqual(1, self.db.structures.count()) + + def test_it_should_not_save_if_is_read_only(self): + poll = self.poll + structure = Structure(data=self.data, poll=poll) + structure.is_read_only = Mock(return_value=True) + self.assertRaises(ReadOnly, structure.save) |