Exemple #1
0
def setup_app(settings):
    wsgi_app = kotti.tests.setup_app(settings)
    # The content fixture that calls 'populate' doesn't have events
    # set up.  That's why we need to trigger workflow initialization
    # by hand:
    reset_workflow()
    return wsgi_app
Exemple #2
0
    def test_reset_workflow_purge_existing(self):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document()
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u'public')
        assert content.state == u'public'
        reset_workflow(purge_existing=True)
        assert content.state == u'private'
Exemple #3
0
    def test_reset_workflow_purge_existing(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u"public")
        assert content.state == u"public"
        reset_workflow(purge_existing=True)
        assert content.state == u"private"
Exemple #4
0
    def test_reset_workflow_purge_existing(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u'public')
        assert content.state == u'public'
        with patch('kotti.workflow.transaction.commit'):
            reset_workflow(purge_existing=True)
        assert content.state == u'private'
Exemple #5
0
    def test_reset_workflow_purge_existing(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, "public")
        assert content.state == "public"
        with patch("kotti.workflow.transaction.commit"):
            reset_workflow(purge_existing=True)
        assert content.state == "private"
Exemple #6
0
    def test_reset_workflow(self):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document()
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u'public')
        assert content.state == u'public'
        save_acl = content.__acl__
        content.__acl__ = []
        reset_workflow()
        assert content.state == u'public'
        assert len(content.__acl__) == len(save_acl)
Exemple #7
0
    def test_reset_workflow(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u"public")
        assert content.state == u"public"
        save_acl = content.__acl__
        content.__acl__ = []
        reset_workflow()
        assert content.state == u"public"
        assert len(content.__acl__) == len(save_acl)
Exemple #8
0
    def test_reset_workflow(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, u'public')
        assert content.state == u'public'
        save_acl = content.__acl__
        content.__acl__ = []
        with patch('kotti.workflow.transaction.commit'):
            reset_workflow()
        assert content.state == u'public'
        assert len(content.__acl__) == len(save_acl)
Exemple #9
0
    def test_reset_workflow(self, root, workflow, events):
        from kotti.workflow import get_workflow
        from kotti.workflow import reset_workflow

        content = self.make_document(root)
        wf = get_workflow(content)
        wf.transition_to_state(content, None, "public")
        assert content.state == "public"
        save_acl = content.__acl__
        content.__acl__ = []
        with patch("kotti.workflow.transaction.commit"):
            reset_workflow()
        assert content.state == "public"
        assert len(content.__acl__) == len(save_acl)
Exemple #10
0
def upgrade():
    from kotti import DBSession
    from kotti import get_settings
    from kotti.resources import Document
    from kotti.workflow import get_workflow
    from kotti.workflow import reset_workflow

    is_default = get_settings()['kotti.use_workflow'] == 'kotti:workflow.zcml'
    if not is_default:
        return

    reset_workflow()
    for obj in DBSession.query(Document):
        workflow = get_workflow(obj)
        workflow.transition_to_state(obj, None, 'public')
Exemple #11
0
 def call(self, *args, **kwargs):
     from kotti.workflow import reset_workflow
     return reset_workflow(*args, **kwargs)