author | Aurelien Campeas <aurelien.campeas@logilab.fr> |
Wed, 11 Jun 2014 15:32:07 +0200 | |
changeset 10364 | 8b35a898b334 |
parent 10245 | 7d21c6ac47a3 |
permissions | -rw-r--r-- |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1 |
from cubicweb.devtools.testlib import CubicWebTC |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2 |
from cubicweb.web.views.xmlrss import SERIALIZERS |
9807
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
3 |
|
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
4 |
class EntityXMLViewTC(CubicWebTC): |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
5 |
"""see also cw.sobjects.test.unittest_parsers""" |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
6 |
def test(self): |
9807
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
7 |
rels = ['tags-object', 'in_group-subject', |
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
8 |
'in_state-subject', 'use_email-subject'] |
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
9 |
with self.admin_access.web_request(relation=rels) as req: |
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
10 |
self.assertMultiLineEqual( |
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
11 |
req.user.view('xml'), |
958fc84a730f
[webtests/views_xmlrss] use the new connection api
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
7554
diff
changeset
|
12 |
'''\ |
9828
ad0d461ae18b
[web test] repair test broken by 0872ac2a1db0
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9807
diff
changeset
|
13 |
<CWUser eid="6" cwuri="http://testing.fr/cubicweb/6" cwsource="system"> |
10245
7d21c6ac47a3
[web/views] Use predictable ordering for attributes in entity XML view
Julien Cristau <julien.cristau@logilab.fr>
parents:
9828
diff
changeset
|
14 |
<creation_date>%(cdate)s</creation_date> |
7d21c6ac47a3
[web/views] Use predictable ordering for attributes in entity XML view
Julien Cristau <julien.cristau@logilab.fr>
parents:
9828
diff
changeset
|
15 |
<firstname/> |
7d21c6ac47a3
[web/views] Use predictable ordering for attributes in entity XML view
Julien Cristau <julien.cristau@logilab.fr>
parents:
9828
diff
changeset
|
16 |
<last_login_time/> |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
17 |
<login>admin</login> |
10245
7d21c6ac47a3
[web/views] Use predictable ordering for attributes in entity XML view
Julien Cristau <julien.cristau@logilab.fr>
parents:
9828
diff
changeset
|
18 |
<modification_date>%(mdate)s</modification_date> |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
<surname/> |
10245
7d21c6ac47a3
[web/views] Use predictable ordering for attributes in entity XML view
Julien Cristau <julien.cristau@logilab.fr>
parents:
9828
diff
changeset
|
20 |
<upassword/> |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
21 |
<tags role="object"> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
</tags> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
<in_group role="subject"> |
9828
ad0d461ae18b
[web test] repair test broken by 0872ac2a1db0
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9807
diff
changeset
|
24 |
<CWGroup eid="%(group_eid)s" cwuri="http://testing.fr/cubicweb/%(group_eid)s"/> |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
</in_group> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
<in_state role="subject"> |
9828
ad0d461ae18b
[web test] repair test broken by 0872ac2a1db0
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9807
diff
changeset
|
27 |
<State eid="%(state_eid)s" cwuri="http://testing.fr/cubicweb/%(state_eid)s" name="activated"/> |
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
28 |
</in_state> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
29 |
<use_email role="subject"> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
30 |
</use_email> |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
31 |
</CWUser> |
7554 | 32 |
''' % {'cdate': SERIALIZERS['Datetime'](req.user.creation_date), |
33 |
'mdate': SERIALIZERS['Datetime'](req.user.modification_date), |
|
7553
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
34 |
'state_eid': req.user.in_state[0].eid, |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
35 |
'group_eid': req.user.in_group[0].eid}) |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
36 |
|
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
37 |
|
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
38 |
if __name__ == '__main__': |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
39 |
from logilab.common.testlib import unittest_main |
935423529f45
[datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
40 |
unittest_main() |