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