Пример #1
0
    def test_form_params_method(self):
        from memphis.form.form import Form

        form = Form(None, None)
        form.method = 'params'
        params = {'post': 'info'}
        form.params = params

        self.assertIs(form.getParams(), params)
Пример #2
0
    def test_getParams(self):
        from memphis.form.form import Form, DisplayForm

        request = DummyRequest()

        form = Form(None, request)
        disp_form = DisplayForm(None, request)

        self.assertEqual(form.method, 'post')

        post = {'post': 'info'}
        request.POST = post

        self.assertIs(form.getParams(), post)
        self.assertIs(disp_form.getParams(), Form.params)

        get = {'get': 'info'}
        request.GET = get
        form.method = 'get'
        self.assertIs(form.getParams(), get)

        form.method = 'unknown'
        self.assertEqual(dict(form.getParams()), {})