Exemple #1
0
 def test_get_edit_ok(self):
     from pyvac.views.account import Edit
     from pyvac.models import User, Group
     view = Edit(self.create_request(matchdict={'user_id': self.account_id
                                                }))()
     self.assertEqual(set(view.keys()),
                      set(['errors', 'groups', 'pyvac', 'user',
                           'managers', 'csrf_token', 'use_ldap']))
     self.assertEqual(view['errors'], [])
     groups = [g for g in view['groups']]
     self.assertEqual(len(groups), 3)
     self.assertIsInstance(groups[0], Group)
     self.assertIsInstance(view['user'], User)
     self.assertEqual(view['user'].id, self.account_id)
     self.assertEqual(view['user'].login, self.account_login)
Exemple #2
0
 def test_get_edit_ok(self):
     from pyvac.views.account import Edit
     from pyvac.models import User, Group
     view = Edit(
         self.create_request(matchdict={'user_id': self.account_id}))()
     self.assertEqual(
         set(view.keys()),
         set([
             'errors', 'groups', 'pyvac', 'user', 'managers', 'csrf_token',
             'use_ldap', 'countries', 'partial_time_tooltip'
         ]))
     self.assertEqual(view['errors'], [])
     groups = [g for g in view['groups']]
     self.assertEqual(len(groups), 4)
     self.assertIsInstance(groups[0], Group)
     self.assertIsInstance(view['user'], User)
     self.assertEqual(view['user'].id, self.account_id)
     self.assertEqual(view['user'].login, self.account_login)
Exemple #3
0
 def test_post_edit_ok(self):
     from pyvac.views.account import Edit
     from pyvac.models import User
     view = Edit(
         self.create_request(
             {
                 'form.submitted': '1',
                 'user.login': u'dummy_edited',
                 'user.firstname': u'',
                 'user.lastname': u'',
                 'user.email': u'*****@*****.**',
                 'groups': [u'1']
             },
             matchdict={'user_id': self.account_id}))()
     self.assertIsRedirect(view)
     self.session.flush()
     user = User.by_id(self.session, self.account_id)
     self.assertEqual(user.login, u'dummy_edited')
     self.assertEqual([g.id for g in user.groups], [1])