Exemplo n.º 1
0
    def test_post_create_wrong_pass_ko(self):
        from pyvac.views.account import Create
        from pyvac.models import User, Group
        view = Create(
            self.create_request({
                'form.submitted': u'1',
                'user.login': u'dummy_new',
                'user.password': u'secret',
                'user.firstname': u'',
                'user.lastname': u'',
                'user.email': u'*****@*****.**',
                'confirm_password': u'secret2',
                'groups': [u'1', u'2']
            }))()
        self.assertEqual(
            set(view.keys()),
            set([
                'errors', 'groups', 'pyvac', 'user', 'managers', 'csrf_token',
                'use_ldap', 'countries', 'partial_time_tooltip'
            ]))

        self.assertEqual(view['errors'], [u'passwords do not match'])
        groups = [g for g in view['groups']]
        self.assertEqual(len(groups), 4)
        self.assertIsInstance(groups[0], Group)
        self.assertIsInstance(view['user'], User)
        self.assertIsNone(view['user'].id)
        self.assertIsNone(view['user'].login)
Exemplo n.º 2
0
    def test_get_create_ok(self):
        from pyvac.views.account import Create
        from pyvac.models import User, Group
        view = Create(self.create_request())()
        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.assertIsNone(view['user'].id)
        self.assertIsNone(view['user'].login)
Exemplo n.º 3
0
    def test_get_create_ok(self):
        from pyvac.views.account import Create
        from pyvac.models import User, Group
        view = Create(self.create_request())()
        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.assertIsNone(view['user'].id)
        self.assertIsNone(view['user'].login)
Exemplo n.º 4
0
    def test_post_create_wrong_pass_ko(self):
        from pyvac.views.account import Create
        from pyvac.models import User, Group
        view = Create(self.create_request({'form.submitted': u'1',
                                           'user.login': u'dummy_new',
                                           'user.password': u'secret',
                                           'user.firstname': u'',
                                           'user.lastname': u'',
                                           'user.email': u'*****@*****.**',
                                           'confirm_password': u'secret2',
                                           'groups': [u'1', u'2']
                                           }))()
        self.assertEqual(set(view.keys()),
                         set(['errors', 'groups', 'pyvac', 'user',
                              'managers', 'csrf_token', 'use_ldap']))

        self.assertEqual(view['errors'], [u'passwords do not match'])
        groups = [g for g in view['groups']]
        self.assertEqual(len(groups), 3)
        self.assertIsInstance(groups[0], Group)
        self.assertIsInstance(view['user'], User)
        self.assertIsNone(view['user'].id)
        self.assertIsNone(view['user'].login)
Exemplo n.º 5
0
 def test_post_create_ok(self):
     from pyvac.views.account import Create
     from pyvac.models import User
     view = Create(
         self.create_request({
             'form.submitted': u'1',
             'user.login': u'dummy_new',
             'user.password': u'secret',
             'user.firstname': u'',
             'user.lastname': u'',
             'user.email': u'*****@*****.**',
             'confirm_password': u'secret',
             'groups': [u'1', u'2']
         }))()
     self.assertIsRedirect(view)
     self.account_todelete.append(
         User.by_login(self.session, u'dummy_new').id)