11from ftw .testbrowser import browsing
22from ftw .testbrowser .pages .statusmessages import info_messages
3+ from opengever .base .response import COMMENT_REMOVED_RESPONSE_TYPE
34from opengever .base .response import IResponseContainer
5+ from opengever .base .response import Response
46from opengever .testing import IntegrationTestCase
57from persistent import Persistent
68from persistent .list import PersistentList
79from persistent .mapping import PersistentMapping
810from plone import api
11+ import pickle
912
1013
1114class TestTaskResponses (IntegrationTestCase ):
@@ -26,6 +29,22 @@ def test_response_and_response_changes_are_persistent(self, browser):
2629 self .assertIsInstance (response .changes , PersistentList )
2730 self .assertIsInstance (response .changes [0 ], PersistentMapping )
2831
32+ def test_old_responses_in_task_history_provides_the_transition_property (self ):
33+ """Tasks should only have TaskResponse objects in the response history.
34+ But we've never migrated old response objects.
35+
36+ Because it'd be too much work to migrate all old Response objects to
37+ TaskResponse objects, we ensure here that old Response objects at least
38+ provide the 'transition' property after unpickling.
39+ """
40+ response = Response (response_type = COMMENT_REMOVED_RESPONSE_TYPE )
41+
42+ self .assertFalse (hasattr (response , 'transition' ))
43+
44+ unpickled_response = pickle .loads (pickle .dumps (response ))
45+ self .assertTrue (hasattr (unpickled_response , 'transition' ))
46+ self .assertEqual (unpickled_response .transition , u'' )
47+
2948
3049class TestTaskResponseForm (IntegrationTestCase ):
3150
0 commit comments