web/test/unittest_views_xmlrss.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 06 Feb 2014 19:04:03 +0100
changeset 9584 8209bede1a4b
parent 7554 fdace9d67d96
child 9807 958fc84a730f
permissions -rw-r--r--
[pkg] bump the dependency on logilab.database This will allow use of an extended API. Related to #3526594.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
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
     4
    """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
     5
    def test(self):
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
        req = self.request(relation=['tags-object', 'in_group-subject',
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
                                     'in_state-subject', 'use_email-subject'])
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
        self.assertMultiLineEqual(
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     9
            req.user.view('xml'),
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    10
            '''\
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    11
<CWUser eid="6" cwuri="None6" cwsource="system">
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    12
  <login>admin</login>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    13
  <upassword/>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    14
  <firstname/>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
  <surname/>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    16
  <last_login_time/>
7554
fdace9d67d96 test fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7553
diff changeset
    17
  <creation_date>%(cdate)s</creation_date>
fdace9d67d96 test fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7553
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
  <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
    20
  </tags>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
  <in_group role="subject">
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    22
    <CWGroup eid="%(group_eid)s" cwuri="None%(group_eid)s"/>
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>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
  <in_state role="subject">
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
    <State eid="%(state_eid)s" cwuri="None%(state_eid)s" name="activated"/>
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>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
  <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
    28
  </use_email>
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
</CWUser>
7554
fdace9d67d96 test fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7553
diff changeset
    30
''' % {'cdate': SERIALIZERS['Datetime'](req.user.creation_date),
fdace9d67d96 test fixes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7553
diff changeset
    31
       '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
    32
       '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
    33
       '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
    34
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
935423529f45 [datafeed cw parser] refactor: split logic that was in the parser
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
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
    37
    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
    38
    unittest_main()