web/test/unittest_breadcrumbs.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 11 Sep 2009 12:40:27 +0200
branch3.5
changeset 3176 b94703b131ad
child 3184 613064b49331
permissions -rw-r--r--
hopefully correctly fix the breadcrumbs escaping
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3176
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     1
from cubicweb.devtools.testlib import WebTest
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     2
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     3
class BreadCrumbsTC(WebTest):
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     4
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     5
    def test_base(self):
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     6
        f1 = self.add_entity('Folder', name=u'par&ent')
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     7
        f2 = self.add_entity('Folder', name=u'chi&ld')
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     8
        self.execute('SET F2 filed_under F1 WHERE F1 eid %(f1)s, F2 eid %(f2)s',
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     9
                     {'f1' : f1.eid, 'f2' : f2.eid})
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    10
        self.commit()
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    11
        childrset = self.execute('Folder F WHERE F eid %s' % f2.eid)
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    12
        self.assertEquals(childrset.get_entity(0,0).view('breadcrumbs'),
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    13
                          '<a href="http://testing.fr/cubicweb/folder/715" title="">chi&amp;ld</a>')
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    14
        ibc = self.vreg['components'].select('breadcrumbs', self.request(), rset=childrset)
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    15
        self.assertEquals(ibc.render(),
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    16
                          """<span id="breadcrumbs" class="pathbar">&#160;&gt;&#160;<a href="http://testing.fr/cubicweb/Folder">folder_plural</a>&#160;&gt;&#160;<a href="http://testing.fr/cubicweb/folder/714" title="">par&amp;ent</a>&#160;&gt;&#160;
b94703b131ad hopefully correctly fix the breadcrumbs escaping
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    17
chi&amp;ld</span>""")