test/unittest_entity.py
branchstable
changeset 1905 9c96dd7cc624
parent 1640 65b60f177eb1
child 1977 606923dff11b
equal deleted inserted replaced
1904:e23536d29231 1905:9c96dd7cc624
   372         person.set_attributes(prenom=u'sylvain', nom=u'thénault')
   372         person.set_attributes(prenom=u'sylvain', nom=u'thénault')
   373         person = self.entity('Personne P') # XXX retreival needed ?
   373         person = self.entity('Personne P') # XXX retreival needed ?
   374         self.assertEquals(person.prenom, u'sylvain')
   374         self.assertEquals(person.prenom, u'sylvain')
   375         self.assertEquals(person.nom, u'thénault')
   375         self.assertEquals(person.nom, u'thénault')
   376 
   376 
   377     def test_metainformation(self):
   377     def test_metainformation_and_external_absolute_url(self):
   378         note = self.add_entity('Note', type=u'z')
   378         note = self.add_entity('Note', type=u'z')
   379         metainf = note.metainformation()
   379         metainf = note.metainformation()
   380         self.assertEquals(metainf, {'source': {'adapter': 'native', 'uri': 'system'}, 'type': u'Note', 'extid': None})
   380         self.assertEquals(metainf, {'source': {'adapter': 'native', 'uri': 'system'}, 'type': u'Note', 'extid': None})
   381         self.assertEquals(note.absolute_url(), 'http://testing.fr/cubicweb/note/%s' % note.eid)
   381         self.assertEquals(note.absolute_url(), 'http://testing.fr/cubicweb/note/%s' % note.eid)
   382         metainf['source'] = metainf['source'].copy()
   382         metainf['source'] = metainf['source'].copy()
   383         metainf['source']['base-url']  = 'http://cubicweb2.com/'
   383         metainf['source']['base-url']  = 'http://cubicweb2.com/'
   384         self.assertEquals(note.absolute_url(), 'http://cubicweb2.com/note/%s' % note.eid)
   384         metainf['extid']  = 1234
       
   385         self.assertEquals(note.absolute_url(), 'http://cubicweb2.com/note/1234')
   385 
   386 
   386 if __name__ == '__main__':
   387 if __name__ == '__main__':
   387     from logilab.common.testlib import unittest_main
   388     from logilab.common.testlib import unittest_main
   388     unittest_main()
   389     unittest_main()
   389 
   390