cubicweb/dataimport/test/unittest_importer.py
changeset 11342 62a7100d774b
parent 11279 e4f11ef1face
child 11393 e148b384a782
equal deleted inserted replaced
11341:bd3cd3691ade 11342:62a7100d774b
    62             rset = cnx.execute('Any X WHERE X is Personne')
    62             rset = cnx.execute('Any X WHERE X is Personne')
    63             entity = rset.get_entity(0, 0)
    63             entity = rset.get_entity(0, 0)
    64             self.assertEqual(entity.nom, u'de la lune')
    64             self.assertEqual(entity.nom, u'de la lune')
    65             self.assertEqual(entity.prenom, u'Jean')
    65             self.assertEqual(entity.prenom, u'Jean')
    66 
    66 
       
    67     def test_bytes_attribute(self):
       
    68         with self.admin_access.repo_cnx() as cnx:
       
    69             importer = self.importer(cnx)
       
    70             personne = ExtEntity('Personne', 1, {'photo': set([b'poilu']),
       
    71                                                  'nom': set([u'alf'])})
       
    72             importer.import_entities([personne])
       
    73             cnx.commit()
       
    74             entity = cnx.find('Personne').one()
       
    75             self.assertEqual(entity.photo.getvalue(), b'poilu')
       
    76 
    67     def test_import_missing_required_attribute(self):
    77     def test_import_missing_required_attribute(self):
    68         """Check import of ext entity with missing required attribute"""
    78         """Check import of ext entity with missing required attribute"""
    69         with self.admin_access.repo_cnx() as cnx:
    79         with self.admin_access.repo_cnx() as cnx:
    70             importer = self.importer(cnx)
    80             importer = self.importer(cnx)
    71             tag = ExtEntity('Personne', 2, {'prenom': set([u'Jean'])})
    81             tag = ExtEntity('Personne', 2, {'prenom': set([u'Jean'])})