~abompard/mailman/subpolicy

« back to all changes in this revision

Viewing changes to src/mailman/model/tests/test_workflow.py

  • Committer: Aurelien Bompard
  • Date: 2015-04-10 19:47:00 UTC
  • Revision ID: abompard@redhat.com-20150410194700-l35ebzcpdkblmtmk
Make sure stored state is deleted after restoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
import unittest
26
26
 
 
27
from mailman.config import config
27
28
from mailman.interfaces.workflow import IWorkflowStateManager
28
29
from mailman.testing.layers import ConfigLayer
29
30
from zope.component import getUtility
108
109
        self._manager.save(name, key)
109
110
        workflow = self._manager.restore('ewe', 'fly')
110
111
        self.assertIsNone(workflow)
 
112
 
 
113
    def test_restore_cleanup(self):
 
114
        # After restoring, stale data must be deleted from the database
 
115
        name = 'ant'
 
116
        key = 'bee'
 
117
        self._manager.save(name, key)
 
118
        self.assertIsNotNone(self._manager.restore(name, key))
 
119
        config.db.store.flush() # there's some caching involved
 
120
        self.assertIsNone(self._manager.restore(name, key))