Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
work-a-round for different HTML5 required bool rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
jedie committed Jul 26, 2015
1 parent ced4821 commit 3cf61ad
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_secure_login.py
Expand Up @@ -13,6 +13,7 @@

# set: DJANGO_SETTINGS_MODULE:tests.test_utils.test_settings to run the tests

import django
from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.http import HttpResponseBadRequest
Expand Down Expand Up @@ -46,12 +47,18 @@ def test_existing_superuser(self):
def test_secure_login_page(self):
response = self.client.get(self.secure_login_url)
# debug_response(response)

if django.VERSION >= (1, 8):
required_html = "required"
else:
required_html = 'required="True"'

self.assertContainsHtml(response,
'<input id="id_username" maxlength="254" name="username" type="text" class="required" required="True" />'
'<input id="id_username" maxlength="254" name="username" type="text" class="required" %s />' % required_html
)
self.assertContainsHtml(response,
'<input id="id_password" maxlength="%i" name="password" type="password" class="required" required="True" />' % (
crypt.CLIENT_DATA_LEN
'<input id="id_password" maxlength="%i" name="password" type="password" class="required" %s />' % (
crypt.CLIENT_DATA_LEN, required_html
)
)

Expand Down

0 comments on commit 3cf61ad

Please sign in to comment.