web/test/unittest_views_xmlrss.py
changeset 11057 0b59724cb3f2
parent 11052 058bb3dc685f
child 11058 23eb30449fe5
equal deleted inserted replaced
11052:058bb3dc685f 11057:0b59724cb3f2
     1 from cubicweb.devtools.testlib import CubicWebTC
       
     2 from cubicweb.web.views.xmlrss import SERIALIZERS
       
     3 
       
     4 class EntityXMLViewTC(CubicWebTC):
       
     5     """see also cw.sobjects.test.unittest_parsers"""
       
     6     def test(self):
       
     7         rels = ['tags-object', 'in_group-subject',
       
     8                 'in_state-subject', 'use_email-subject']
       
     9         with self.admin_access.web_request(relation=rels) as req:
       
    10             self.assertMultiLineEqual(
       
    11                 req.user.view('xml'),
       
    12                 '''\
       
    13 <CWUser eid="6" cwuri="http://testing.fr/cubicweb/6" cwsource="system">
       
    14   <creation_date>%(cdate)s</creation_date>
       
    15   <firstname/>
       
    16   <last_login_time/>
       
    17   <login>admin</login>
       
    18   <modification_date>%(mdate)s</modification_date>
       
    19   <surname/>
       
    20   <upassword/>
       
    21   <tags role="object">
       
    22   </tags>
       
    23   <in_group role="subject">
       
    24     <CWGroup eid="%(group_eid)s" cwuri="http://testing.fr/cubicweb/%(group_eid)s"/>
       
    25   </in_group>
       
    26   <in_state role="subject">
       
    27     <State eid="%(state_eid)s" cwuri="http://testing.fr/cubicweb/%(state_eid)s" name="activated"/>
       
    28   </in_state>
       
    29   <use_email role="subject">
       
    30   </use_email>
       
    31 </CWUser>
       
    32 ''' % {'cdate': SERIALIZERS['Datetime'](req.user.creation_date),
       
    33        'mdate': SERIALIZERS['Datetime'](req.user.modification_date),
       
    34        'state_eid': req.user.in_state[0].eid,
       
    35        'group_eid': req.user.in_group[0].eid})
       
    36 
       
    37 
       
    38 if __name__ == '__main__':
       
    39     from logilab.common.testlib import unittest_main
       
    40     unittest_main()