server/test/unittest_repository.py
changeset 4913 083b4d454192
parent 4835 13b0b96d7982
child 5103 2b242604fc42
equal deleted inserted replaced
4912:9767cc516b4f 4913:083b4d454192
   383     def test_add_delete_info(self):
   383     def test_add_delete_info(self):
   384         entity = self.repo.vreg['etypes'].etype_class('Personne')(self.session)
   384         entity = self.repo.vreg['etypes'].etype_class('Personne')(self.session)
   385         entity.eid = -1
   385         entity.eid = -1
   386         entity.complete = lambda x: None
   386         entity.complete = lambda x: None
   387         self.session.set_pool()
   387         self.session.set_pool()
   388         self.repo.add_info(self.session, entity, self.repo.sources_by_uri['system'])
   388         self.repo.add_info(self.session, entity, self.repo.system_source)
   389         cu = self.session.system_sql('SELECT * FROM entities WHERE eid = -1')
   389         cu = self.session.system_sql('SELECT * FROM entities WHERE eid = -1')
   390         data = cu.fetchall()
   390         data = cu.fetchall()
   391         self.assertIsInstance(data[0][3], datetime)
   391         self.assertIsInstance(data[0][3], datetime)
   392         data[0] = list(data[0])
   392         data[0] = list(data[0])
   393         data[0][3] = None
   393         data[0][3] = None
   394         self.assertEquals(tuplify(data), [(-1, 'Personne', 'system', None, None)])
   394         self.assertEquals(tuplify(data), [(-1, 'Personne', 'system', None, None)])
   395         self.repo.delete_info(self.session, -1)
   395         self.repo.delete_info(self.session, entity, 'system', None)
   396         #self.repo.commit()
   396         #self.repo.commit()
   397         cu = self.session.system_sql('SELECT * FROM entities WHERE eid = -1')
   397         cu = self.session.system_sql('SELECT * FROM entities WHERE eid = -1')
   398         data = cu.fetchall()
   398         data = cu.fetchall()
   399         self.assertEquals(data, [])
   399         self.assertEquals(data, [])
   400 
   400