cubicweb/dataimport/test/unittest_importer.py
changeset 11279 e4f11ef1face
parent 11275 814f54d6183b
parent 11139 df928a3a94e3
child 11342 62a7100d774b
equal deleted inserted replaced
11277:baed516c6f6e 11279:e4f11ef1face
   122             rset = cnx.execute('Any X WHERE X is Personne, X nom "Richelieu"')
   122             rset = cnx.execute('Any X WHERE X is Personne, X nom "Richelieu"')
   123             entity = rset.get_entity(0, 0)
   123             entity = rset.get_entity(0, 0)
   124             self.assertEqual(entity.nom, u'Richelieu')
   124             self.assertEqual(entity.nom, u'Richelieu')
   125             self.assertEqual(len(entity.connait), 0)
   125             self.assertEqual(len(entity.connait), 0)
   126 
   126 
       
   127     def test_import_order(self):
       
   128         """Check import of ext entity in both order"""
       
   129         with self.admin_access.repo_cnx() as cnx:
       
   130             importer = self.importer(cnx)
       
   131             richelieu = ExtEntity('Personne', 3, {'nom': set([u'Richelieu']),
       
   132                                                   'enfant': set([4])})
       
   133             athos = ExtEntity('Personne', 4, {'nom': set([u'Athos'])})
       
   134             importer.import_entities([richelieu, athos])
       
   135             cnx.commit()
       
   136             rset = cnx.execute('Any X WHERE X is Personne, X nom "Richelieu"')
       
   137             entity = rset.get_entity(0, 0)
       
   138             self.assertEqual(entity.enfant[0].nom, 'Athos')
       
   139 
   127     def test_update(self):
   140     def test_update(self):
   128         """Check update of ext entity"""
   141         """Check update of ext entity"""
   129         with self.admin_access.repo_cnx() as cnx:
   142         with self.admin_access.repo_cnx() as cnx:
   130             importer = self.importer(cnx)
   143             importer = self.importer(cnx)
   131             # First import
   144             # First import