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