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)
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)
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())
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)
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)