Skip to content

Commit 16513fe

Browse files
committed
Test for button class
1 parent 01b59d6 commit 16513fe

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/tests/tests.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,16 @@ def test_better_readonly_password_widget(self):
257257
user = User.objects.get(username='testclient')
258258
form = UserChangeForm(instance=user)
259259

260-
self.assertIn(_('*************'), form.as_table())
260+
html = form.as_table()
261+
self.assertIn(_('*************'), html)
261262
version = django.VERSION[:2]
262263

263-
if version in ((4, 2), (5, 0)):
264-
self.assertIn('<a href="../../{0}/password/">'.format(user.id), form.as_table())
264+
if version < (4, 2):
265+
self.assertIn('<a href="../password/"', html)
266+
elif version < (5, 1):
267+
self.assertIn('<a href="../../{0}/password/">'.format(user.id), html)
265268
else:
266-
self.assertIn('<a href="../password/"', form.as_table())
269+
self.assertIn('<a href="../password/" class="button"', html)
267270

268271

269272
class UserAdminTest(TestCase):

0 commit comments

Comments
 (0)