diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 20:16:42 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-09-25 20:16:42 (GMT) |
commit | 71e4df8e2d613c7500e45dcf3bca00368062c865 (patch) | |
tree | 6ebefa4c204e7b4ad4b987f7c1fb628ab59d634f /webapp/polls/tests/structure_tests.py | |
parent | 85eba59ab50a5430ac1877af4d79d5b3de2b9c7f (diff) |
add is_read_only method to structure class
Diffstat (limited to 'webapp/polls/tests/structure_tests.py')
-rw-r--r-- | webapp/polls/tests/structure_tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/webapp/polls/tests/structure_tests.py b/webapp/polls/tests/structure_tests.py index 8ec1d21..ebb0f7e 100644 --- a/webapp/polls/tests/structure_tests.py +++ b/webapp/polls/tests/structure_tests.py @@ -324,6 +324,16 @@ class StructureTests(MongoTestCase): def test_it_should_respond_to_ready_only_msg(self): self.assertTrue(hasattr(Structure, 'READ_ONLY_MSG')) + def test_it_should_be_read_only_when_poll_has_results(self): + poll = self.poll + structure = Structure(data={}, poll=poll) + self.assertFalse(poll.has_result()) + self.assertFalse(structure.is_read_only()) + + poll.has_result = Mock(return_value=True) + self.assertTrue(poll.has_result()) + self.assertTrue(structure.is_read_only()) + class UploadOptionImagesTest(MongoTestCase): |