13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """ |
|
19 |
|
20 """ |
|
21 from cubicweb.devtools.testlib import CubicWebTC |
18 from cubicweb.devtools.testlib import CubicWebTC |
22 from cubicweb.devtools.htmlparser import DTDValidator |
19 from cubicweb.devtools.htmlparser import DTDValidator |
23 |
20 |
24 |
21 |
25 class LogFormTemplateTC(CubicWebTC): |
22 class LogFormTemplateTC(CubicWebTC): |
26 |
23 |
27 def _login_labels(self): |
24 def _login_labels(self): |
28 valid = self.content_type_validators.get('text/html', DTDValidator)() |
25 valid = self.content_type_validators.get('text/html', DTDValidator)() |
|
26 req = self.request() |
|
27 req.cnx.anonymous_connection = True |
29 page = valid.parse_string(self.vreg['views'].main_template(self.request(), 'login')) |
28 page = valid.parse_string(self.vreg['views'].main_template(self.request(), 'login')) |
|
29 req.cnx.anonymous_connection = False |
30 return page.find_tag('label') |
30 return page.find_tag('label') |
31 |
31 |
32 def test_label(self): |
32 def test_label(self): |
33 self.set_option('allow-email-login', 'yes') |
33 self.set_option('allow-email-login', 'yes') |
34 self.assertEquals(self._login_labels(), ['login or email', 'password']) |
34 self.assertEquals(self._login_labels(), ['login or email', 'password']) |