# HG changeset patch # User Denis Laxalde # Date 1449155943 -3600 # Node ID 1186757bc6166d28a09aae1e4970e8d678d2fff7 # Parent f7179ecfbae0bf9524c1ff582d819e55d421f730# Parent 1079d68130e1e780791ceb2050e8a8b7a910f48d Merge default heads published "concurrently" diff -r f7179ecfbae0 -r 1186757bc616 dataimport/pgstore.py --- a/dataimport/pgstore.py Thu Nov 26 14:23:38 2015 +0100 +++ b/dataimport/pgstore.py Thu Dec 03 16:19:03 2015 +0100 @@ -31,6 +31,7 @@ from six.moves import cPickle as pickle, range from cubicweb.utils import make_uid +from cubicweb.server.utils import eschema_eid from cubicweb.server.sqlutils import SQL_PREFIX from cubicweb.dataimport.stores import NoHookRQLObjectStore @@ -407,7 +408,7 @@ _sql[statement] = [data] def add_entity(self, cnx, entity): - with self._storage_handler(entity, 'added'): + with self._storage_handler(cnx, entity, 'added'): attrs = self.preprocess_entity(entity) rtypes = self._inlined_rtypes_cache.get(entity.cw_etype, ()) if isinstance(rtypes, str): diff -r f7179ecfbae0 -r 1186757bc616 dataimport/test/test_pgstore.py --- a/dataimport/test/test_pgstore.py Thu Nov 26 14:23:38 2015 +0100 +++ b/dataimport/test/test_pgstore.py Thu Dec 03 16:19:03 2015 +0100 @@ -24,6 +24,7 @@ from logilab.common.testlib import TestCase, unittest_main from cubicweb.dataimport import pgstore +from cubicweb.devtools import testlib class CreateCopyFromBufferTC(TestCase): @@ -90,5 +91,16 @@ expected = u'''42\téléphant\n6\tbabar''' self.assertEqual(expected, results.getvalue()) + +class SQLGenObjectStoreTC(testlib.CubicWebTC): + + def test_prepare_insert_entity(self): + with self.admin_access.repo_cnx() as cnx: + store = pgstore.SQLGenObjectStore(cnx) + eid = store.prepare_insert_entity('CWUser', login=u'toto', + upassword=u'pwd') + self.assertIsNotNone(eid) + + if __name__ == '__main__': unittest_main()