web/test/unittest_views_basetemplates.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Jun 2009 15:06:55 +0200
changeset 2057 0a0cbccafcb5
parent 1977 606923dff11b
child 2650 18aec79ec3a3
permissions -rw-r--r--
test broken, deprecated module; kill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     1
"""
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     2
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     3
:organization: Logilab
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1776
diff changeset
     7
"""
1776
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     8
from cubicweb.devtools.testlib import WebTest
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     9
from cubicweb.devtools.htmlparser import DTDValidator
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    10
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    11
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    12
class LogFormTemplateTC(WebTest):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    13
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    14
    def _login_labels(self):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    15
        valid = self.content_type_validators.get('text/html', DTDValidator)()
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    16
        page = valid.parse_string(self.vreg.main_template(self.request(), 'login'))
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    17
        return page.find_tag('label')
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    18
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    19
    def test_label(self):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    20
        self.set_option('allow-email-login', 'yes')
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    21
        self.assertEquals(self._login_labels(), ['login or email', 'password'])
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    22
        self.set_option('allow-email-login', 'no')
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    23
        self.assertEquals(self._login_labels(), ['login', 'password'])