author | sylvain.thenault@logilab.fr |
Thu, 14 May 2009 12:50:34 +0200 | |
changeset 1813 | 4e4333bb56b3 |
parent 1776 | 4be367276874 |
child 1977 | 606923dff11b |
permissions | -rw-r--r-- |
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']) |