# HG changeset patch # User Denis Laxalde # Date 1375780807 -7200 # Node ID be05b42b48253cbbb303ea75afa1413d798b0c2f # Parent 312062f539810e06930ba596ce0a483ec5a5b298 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. diff -r 312062f53981 -r be05b42b4825 test/data/entities.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' diff -r 312062f53981 -r be05b42b4825 test/data/schema.py --- 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() diff -r 312062f53981 -r be05b42b4825 test/unittest_entity.py --- 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): diff -r 312062f53981 -r be05b42b4825 test/unittest_schema.py --- 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',