Example #1
0
    def testGetAllTransactions(self):
        request = self.request
        view = UndoView(self.folder1, request)
        expected = self.undo.getTransactions()
        self.assertEqual(view.getAllTransactions(), expected)
        self.assert_(self.undo.context is self.folder1)

        # test showall parameter
        view.getAllTransactions(showall=True)
        self.assert_(self.undo.context is None)
Example #2
0
    def testUndoPrincipalTransactions(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)
        view = UndoView(self.folder1, request)

        # Just test whether it accepts the principal.  We know that
        # our undo dummy above "works".
        self.undo._emulatePublication(request)
        view.undoPrincipalTransactions(['6'])
        self.assert_(self.undo.principal is bonobo)
Example #3
0
    def testPrincipalLastTransactionIsUndo(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        view = UndoView(self.folder1, request)
        self.failIf(view.principalLastTransactionIsUndo())

        # now undo the last transaction
        self.undo._emulatePublication(request)
        self.undo.undoTransactions(['6'])

        self.assert_(view.principalLastTransactionIsUndo())
Example #4
0
    def testUndoPrincipalLastTransaction(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        self.undo._emulatePublication(request)
        view = UndoView(self.folder1, request)
        view.undoPrincipalLastTransaction()

        last_txn = self.undo.getTransactions(None, 0, 1)[0]
        self.assert_(last_txn.has_key('undo'))
        self.assert_(last_txn['undo'])
        self.assertEqual(last_txn['user_name'], bonobo.id)
Example #5
0
    def testGetPrincipalTransactions(self):
        request = self.request
        bonobo = principalRegistry.getPrincipal('bonobo')
        request.setPrincipal(bonobo)

        view = UndoView(self.folder1, request)
        expected = self.undo.getPrincipalTransactions(bonobo)
        self.assertEqual(view.getPrincipalTransactions(), expected)
        self.assert_(self.undo.context is self.folder1)
        self.assert_(self.undo.principal is bonobo)

        # test showall parameter and principal
        self.undo.principal = None
        view.getPrincipalTransactions(showall=True)
        self.assert_(self.undo.context is None)
        self.assert_(self.undo.principal is bonobo)