server/test/unittest_undo.py
changeset 5174 78438ad513ca
parent 5104 7aab5286f037
child 5423 e15abfdcce38
equal deleted inserted replaced
5173:73760bbb66bd 5174:78438ad513ca
   142         e.clear_all_caches()
   142         e.clear_all_caches()
   143         errors = self.cnx.undo_transaction(txuuid)
   143         errors = self.cnx.undo_transaction(txuuid)
   144         undotxuuid = self.commit()
   144         undotxuuid = self.commit()
   145         self.assertEquals(undotxuuid, None) # undo not undoable
   145         self.assertEquals(undotxuuid, None) # undo not undoable
   146         self.assertEquals(errors, [])
   146         self.assertEquals(errors, [])
   147         self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': toto.eid}, 'x'))
   147         self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': toto.eid}))
   148         self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': e.eid}, 'x'))
   148         self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': e.eid}))
   149         self.failUnless(self.execute('Any X WHERE X has_text "toto@logilab"'))
   149         self.failUnless(self.execute('Any X WHERE X has_text "toto@logilab"'))
   150         self.assertEquals(toto.state, 'activated')
   150         self.assertEquals(toto.state, 'activated')
   151         self.assertEquals(toto.get_email(), 'toto@logilab.org')
   151         self.assertEquals(toto.get_email(), 'toto@logilab.org')
   152         self.assertEquals([(p.pkey, p.value) for p in toto.reverse_for_user],
   152         self.assertEquals([(p.pkey, p.value) for p in toto.reverse_for_user],
   153                           [('ui.default-text-format', 'text/rest')])
   153                           [('ui.default-text-format', 'text/rest')])
   214         p = session.create_entity('Personne', nom=u'louis', fiche=c)
   214         p = session.create_entity('Personne', nom=u'louis', fiche=c)
   215         txuuid = self.commit()
   215         txuuid = self.commit()
   216         errors = self.cnx.undo_transaction(txuuid)
   216         errors = self.cnx.undo_transaction(txuuid)
   217         self.commit()
   217         self.commit()
   218         self.failIf(errors)
   218         self.failIf(errors)
   219         self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': c.eid}, 'x'))
   219         self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': c.eid}))
   220         self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': p.eid}, 'x'))
   220         self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': p.eid}))
   221         self.failIf(self.execute('Any X,Y WHERE X fiche Y'))
   221         self.failIf(self.execute('Any X,Y WHERE X fiche Y'))
   222         self.session.set_pool()
   222         self.session.set_pool()
   223         for eid in (p.eid, c.eid):
   223         for eid in (p.eid, c.eid):
   224             self.failIf(session.system_sql(
   224             self.failIf(session.system_sql(
   225                 'SELECT * FROM entities WHERE eid=%s' % eid).fetchall())
   225                 'SELECT * FROM entities WHERE eid=%s' % eid).fetchall())