[dataimport] prepare_insert_entity should not crash with SQLGenObjectStore
authorSamuel Trégouët <samuel.tregouet@logilab.fr>
Thu, 03 Dec 2015 14:55:10 +0100
changeset 10943 1079d68130e1
parent 10942 b089858c49a2
child 10947 1186757bc616
[dataimport] prepare_insert_entity should not crash with SQLGenObjectStore
dataimport/test/test_pgstore.py
--- a/dataimport/test/test_pgstore.py	Tue Dec 01 13:39:17 2015 +0100
+++ b/dataimport/test/test_pgstore.py	Thu Dec 03 14:55:10 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()