web/test/unittest_views_basetemplates.py
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 27 May 2009 08:39:16 +0200
changeset 1956 9865daa96cd7
parent 1776 4be367276874
child 1977 606923dff11b
permissions -rw-r--r--
[views][plot] piechart view now accepts either final or non final entities in the first column
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1776
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     1
from cubicweb.devtools.testlib import WebTest
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     2
from cubicweb.devtools.htmlparser import DTDValidator
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     3
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     4
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     5
class LogFormTemplateTC(WebTest):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     6
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     7
    def _login_labels(self):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
     8
        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
     9
        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
    10
        return page.find_tag('label')
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
    def test_label(self):
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    13
        self.set_option('allow-email-login', 'yes')
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    14
        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
    15
        self.set_option('allow-email-login', 'no')
4be367276874 adapt login box message to allow-email-login configuration
Florent <florent@secondweb.fr>
parents:
diff changeset
    16
        self.assertEquals(self._login_labels(), ['login', 'password'])