Ejemplo n.º 1
0
    def test_modify_user_error(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()

        request = self.make_request(POST={'form.buttons.modify': 'Modify'})

        view = ModifyUserForm(user, request)
        view.csrf = False
        view.update_form()

        self.assertIn('Please fix indicated errors.',
                      request.render_messages())
Ejemplo n.º 2
0
    def test_modify_user_error(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()

        request = self.make_request(
            POST = {'form.buttons.modify': 'Modify'})

        view = ModifyUserForm(user, request)
        view.csrf = False
        view.update_form()

        self.assertIn(
            'Please fix indicated errors.',
            request.render_messages())
Ejemplo n.º 3
0
    def test_modify_user(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()
        request = self.make_request(
            POST = {'form.buttons.modify': 'Modify',
                    'username': '******',
                    'email': '*****@*****.**',
                    'password': '******',
                    'validated': 'false',
                    'suspended': 'true'})

        view = ModifyUserForm(user, request)
        view.csrf = False
        view.update_form()

        self.assertEqual(user.username, 'NKim')
        self.assertEqual(user.email, '*****@*****.**')
Ejemplo n.º 4
0
    def test_modify_user(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()
        request = self.make_request(
            POST={
                'form.buttons.modify': 'Modify',
                'username': '******',
                'email': '*****@*****.**',
                'password': '******',
                'validated': 'false',
                'suspended': 'true'
            })

        view = ModifyUserForm(user, request)
        view.csrf = False
        view.update_form()

        self.assertEqual(user.username, 'NKim')
        self.assertEqual(user.email, '*****@*****.**')
Ejemplo n.º 5
0
    def test_modify_user_forbidden(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()

        request = self.make_request(
            POST = {'form.buttons.modify': 'Modify',
                    'username': '******',
                    'email': '*****@*****.**',
                    'password': '******',
                    'validated': 'false',
                    'suspended': 'true',
                    })

        view = ModifyUserForm(user, request)
        res = None
        try:
            view.update_form()
        except Exception as err:
            res = err

        self.assertIsInstance(res, HTTPForbidden)
        self.assertEqual(str(res), 'Form authenticator is not found.')
Ejemplo n.º 6
0
    def test_modify_user_forbidden(self):
        from ptahcrowd.user import ModifyUserForm

        user = self._user()

        request = self.make_request(
            POST={
                'form.buttons.modify': 'Modify',
                'username': '******',
                'email': '*****@*****.**',
                'password': '******',
                'validated': 'false',
                'suspended': 'true',
            })

        view = ModifyUserForm(user, request)
        res = None
        try:
            view.update_form()
        except Exception as err:
            res = err

        self.assertIsInstance(res, HTTPForbidden)
        self.assertEqual(str(res), 'Form authenticator is not found.')