Beispiel #1
0
 def test_update_password(self):
     from pyvac.views.user import ChangePassword as ChangePwd
     view = ChangePwd(self.create_request())()
     self.assertEqual(set(view.keys()),
                      set(['csrf_token', 'pyvac', 'user', 'errors',
                           'use_ldap']))
     self.assertEqual(view['user'].login, 'admin')
Beispiel #2
0
 def test_change_password_post_ko_unchanged(self):
     from pyvac.models import User
     from pyvac.views.user import ChangePassword as ChangePwd
     view = ChangePwd(self.create_request({'form.submitted': '1',
                                           'current_password': '******',
                                           'user.password': '******',
                                           'confirm_password': '******',
                                           }))()
     self.assertEqual(view['errors'],
                      ['password is inchanged'])
     admin = User.by_credentials(self.session, 'admin', 'changeme')
     self.assertIsInstance(admin, User)
Beispiel #3
0
 def test_change_password_post_ok(self):
     from pyvac.models import User
     from pyvac.views.user import ChangePassword as ChangePwd
     ChangePwd(self.create_request({'form.submitted': '1',
                                    'current_password': '******',
                                    'user.password': '******',
                                    'confirm_password': '******',
                                    }))()
     admin = User.by_credentials(self.session, 'admin', 'newpassw')
     self.assertIsInstance(admin, User)
     admin.password = '******'
     self.session.add(admin)
Beispiel #4
0
 def test_change_password_post_ko_not_matched(self):
     from pyvac.models import User
     from pyvac.views.user import ChangePassword as ChangePwd
     view = ChangePwd(self.create_request({'form.submitted': '1',
                                           'current_password': '******',
                                           'user.password': '******',
                                           'confirm_password': '******',
                                           }))()
     self.assertEqual(view['errors'],
                      ['current password is not correct',
                       'passwords do not match'])
     admin = User.by_credentials(self.session, 'admin', 'changeme')
     self.assertIsInstance(admin, User)