Esempio n. 1
0
    def test_create_user_back(self):
        from ptah.crowd.module import CrowdModule
        from ptah.crowd.user import CreateUserForm

        request = DummyRequest(
            POST = {'form.buttons.back': 'Back'})
        mod = CrowdModule(None, request)

        view = CreateUserForm(mod, request)
        try:
            view.update()
        except Exception, res:
            pass
Esempio n. 2
0
    def test_create_user_error(self):
        from ptah.crowd.module import CrowdModule
        from ptah.crowd.user import CreateUserForm

        f = CreateUserForm(None, None)

        request = DummyRequest(
            POST = {'form.buttons.create': 'Create',
                    CreateUserForm.csrfname: f.token})
        mod = CrowdModule(None, request)

        view = CreateUserForm(mod, request)
        view.update()
        self.assertIn(
            'Please fix indicated errors.',
            request.session['msgservice'][0])
Esempio n. 3
0
    def test_create_user(self):
        from ptah.crowd.module import CrowdModule
        from ptah.crowd.user import CreateUserForm

        f = CreateUserForm(None, None)

        request = DummyRequest(
            POST = {'name': 'NKim',
                    'login': '******',
                    'password': '******',
                    'validated': 'false',
                    'suspended': 'true',
                    'form.buttons.create': 'Create',
                    CreateUserForm.csrfname: f.token})
        mod = CrowdModule(None, request)

        view = CreateUserForm(mod, request)
        try:
            view.update()
        except Exception, res:
            pass