[entitiestests/base] don't store an entity on the test case
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 02 Jul 2014 18:19:47 +0200
changeset 9859 fc978ff7f381
parent 9858 4266e13fd5c1
child 9860 e24bf60428d3
[entitiestests/base] don't store an entity on the test case Make do with an eid.
entities/test/unittest_base.py
--- a/entities/test/unittest_base.py	Thu Jun 05 17:06:03 2014 +0200
+++ b/entities/test/unittest_base.py	Wed Jul 02 18:19:47 2014 +0200
@@ -31,7 +31,7 @@
 
     def setup_database(self):
         with self.admin_access.repo_cnx() as cnx:
-            self.member = self.create_user(cnx, 'member')
+            self.membereid = self.create_user(cnx, 'member').eid
             cnx.commit()
 
 
@@ -41,16 +41,20 @@
         with self.new_access('member').repo_cnx() as cnx:
             entity = cnx.create_entity('Bookmark', title=u"hello", path=u'project/cubicweb')
             cnx.commit()
-            self.assertEqual(entity.creator.eid, self.member.eid)
+            self.assertEqual(entity.creator.eid, self.membereid)
             self.assertEqual(entity.dc_creator(), u'member')
 
     def test_type(self):
         #dc_type may be translated
-        self.assertEqual(self.member.dc_type(), 'CWUser')
+        with self.admin_access.client_cnx() as cnx:
+            member = cnx.entity_from_eid(self.membereid)
+            self.assertEqual(member.dc_type(), 'CWUser')
 
     def test_cw_etype(self):
         #cw_etype is never translated
-        self.assertEqual(self.member.cw_etype, 'CWUser')
+        with self.admin_access.client_cnx() as cnx:
+            member = cnx.entity_from_eid(self.membereid)
+            self.assertEqual(member.cw_etype, 'CWUser')
 
     def test_entity_meta_attributes(self):
         # XXX move to yams