Do not use cubicweb-card in rest_path tests stable
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 06 Aug 2013 11:20:07 +0200
branchstable
changeset 9214 be05b42b4825
parent 9213 312062f53981
child 9215 5b9fedf67a29
Do not use cubicweb-card in rest_path tests Card overrides the rest_path method, so it does not make sense to use it in cw tests.
test/data/entities.py
test/data/schema.py
test/unittest_entity.py
test/unittest_schema.py
--- a/test/data/entities.py	Thu Aug 01 13:55:11 2013 +0200
+++ b/test/data/entities.py	Tue Aug 06 11:20:07 2013 +0200
@@ -28,6 +28,9 @@
     fetch_attrs, cw_fetch_order = fetch_config(['nom', 'prenom'])
     rest_attr = 'nom'
 
+class Ami(Societe):
+    __regid__ = 'Ami'
+    rest_attr = 'nom'
 
 class Note(AnyEntity):
     __regid__ = 'Note'
--- a/test/data/schema.py	Thu Aug 01 13:55:11 2013 +0200
+++ b/test/data/schema.py	Tue Aug 06 11:20:07 2013 +0200
@@ -44,6 +44,10 @@
     associe = SubjectRelation('Personne', cardinality='1*',
                               constraints=[RQLConstraint('S actionnaire SOC, O actionnaire SOC')])
 
+class Ami(EntityType):
+    """A Person, for which surname is not required"""
+    prenom = String()
+    nom = String()
 
 class Societe(EntityType):
     nom = String()
--- a/test/unittest_entity.py	Thu Aug 01 13:55:11 2013 +0200
+++ b/test/unittest_entity.py	Tue Aug 06 11:20:07 2013 +0200
@@ -692,16 +692,16 @@
         person.cw_clear_all_caches()
         self.assertEqual(person.rest_path(), unicode(person.eid))
         self.assertEqual(person2.rest_path(), unicode(person2.eid))
-        # unique attr with None value (wikiid in this case)
-        card1 = req.create_entity('Card', title=u'hop')
-        self.assertEqual(card1.rest_path(), unicode(card1.eid))
+        # unique attr with None value (nom in this case)
+        friend = req.create_entity('Ami', prenom=u'bob')
+        self.assertEqual(friend.rest_path(), unicode(friend.eid))
         # don't use rest if we have /, ? or & in the path (breaks mod_proxy)
-        card2 = req.create_entity('Card', title=u'pod', wikiid=u'zo/bi')
-        self.assertEqual(card2.rest_path(), unicode(card2.eid))
-        card3 = req.create_entity('Card', title=u'pod', wikiid=u'zo&bi')
-        self.assertEqual(card3.rest_path(), unicode(card3.eid))
-        card4 = req.create_entity('Card', title=u'pod', wikiid=u'zo?bi')
-        self.assertEqual(card4.rest_path(), unicode(card4.eid))
+        person3 = req.create_entity('Personne', nom=u'zo/bi')
+        self.assertEqual(person3.rest_path(), unicode(person3.eid))
+        person4 = req.create_entity('Personne', nom=u'zo&bi')
+        self.assertEqual(person4.rest_path(), unicode(person4.eid))
+        person5 = req.create_entity('Personne', nom=u'zo?bi')
+        self.assertEqual(person5.rest_path(), unicode(person5.eid))
 
 
     def test_cw_set_attributes(self):
--- a/test/unittest_schema.py	Thu Aug 01 13:55:11 2013 +0200
+++ b/test/unittest_schema.py	Tue Aug 06 11:20:07 2013 +0200
@@ -157,7 +157,7 @@
         self.assert_(isinstance(schema, CubicWebSchema))
         self.assertEqual(schema.name, 'data')
         entities = sorted([str(e) for e in schema.entities()])
-        expected_entities = ['BaseTransition', 'BigInt', 'Bookmark', 'Boolean', 'Bytes', 'Card',
+        expected_entities = ['Ami', 'BaseTransition', 'BigInt', 'Bookmark', 'Boolean', 'Bytes', 'Card',
                              'Date', 'Datetime', 'Decimal',
                              'CWCache', 'CWConstraint', 'CWConstraintType', 'CWDataImport',
                              'CWEType', 'CWAttribute', 'CWGroup', 'EmailAddress', 'CWRelation',