def test_bug_19349_bound_password_field(self):
     user = User.objects.get(username='******')
     form = UserChangeForm(data={}, instance=user)
     # When rendering the bound password field,
     # ReadOnlyPasswordHashWidget needs the initial
     # value to render correctly
     self.assertEqual(form.initial['password'], form['password'].value())
    def test_bug_19133(self):
        "The change form does not return the password value"
        # Use the form to construct the POST data
        user = User.objects.get(username='******')
        form_for_data = UserChangeForm(instance=user)
        post_data = form_for_data.initial

        # The password field should be readonly, so anything
        # posted here should be ignored; the form will be
        # valid, and give back the 'initial' value for the
        # password field.
        post_data['password'] = '******'
        form = UserChangeForm(instance=user, data=post_data)

        self.assertTrue(form.is_valid())
        self.assertEqual(form.cleaned_data['password'], 'sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161')
    def test_bug_19133(self):
        "The change form does not return the password value"
        # Use the form to construct the POST data
        user = User.objects.get(username='******')
        form_for_data = UserChangeForm(instance=user)
        post_data = form_for_data.initial

        # The password field should be readonly, so anything
        # posted here should be ignored; the form will be
        # valid, and give back the 'initial' value for the
        # password field.
        post_data['password'] = '******'
        form = UserChangeForm(instance=user, data=post_data)

        self.assertTrue(form.is_valid())
        self.assertEqual(
            form.cleaned_data['password'],
            'sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161')
    def test_better_readonly_password_widget(self):
        user = User.objects.get(username='******')
        form = UserChangeForm(instance=user)

        self.assertIn(_('*************'), form.as_table())
 def test_bug_17944_unknown_password_algorithm(self):
     user = User.objects.get(username='******')
     form = UserChangeForm(instance=user)
     self.assertIn(
         _("Invalid password format or unknown hashing algorithm."),
         form.as_table())
 def test_bug_17944_empty_password(self):
     user = User.objects.get(username='******')
     form = UserChangeForm(instance=user)
     self.assertIn(_("No password set."), form.as_table())
 def test_unsuable_password(self):
     user = User.objects.get(username='******')
     user.set_unusable_password()
     user.save()
     form = UserChangeForm(instance=user)
     self.assertIn(_("No password set."), form.as_table())
    def test_better_readonly_password_widget(self):
        user = User.objects.get(username='******')
        form = UserChangeForm(instance=user)

        self.assertIn(_('*************'), form.as_table())
 def test_bug_17944_unknown_password_algorithm(self):
     user = User.objects.get(username='******')
     form = UserChangeForm(instance=user)
     self.assertIn(_("Invalid password format or unknown hashing algorithm."),
                   form.as_table())
Exemple #10
0
 def test_bug_17944_empty_password(self):
     user = User.objects.get(username='******')
     form = UserChangeForm(instance=user)
     self.assertIn(_("No password set."), form.as_table())
Exemple #11
0
 def test_unsuable_password(self):
     user = User.objects.get(username='******')
     user.set_unusable_password()
     user.save()
     form = UserChangeForm(instance=user)
     self.assertIn(_("No password set."), form.as_table())