Example #1
0
 def _submit(self, params, success=True, error_field=''):
     req = self.new_req(params)
     res = cu.handle_contact_form(req)
     if success:
         self.assertTrue(res['success'])
     else:
         self.assertFalse(res['success'])
         self.assertIn(error_field, res['error'])
     return res
Example #2
0
    def test_empty_contact_form(self):
        self.add_languages_to_db()

        # test empty
        res = cu.handle_contact_form(self.req)
        form_keys = ('name', 'surname', 'email', 'phone', 'agreement',
                     'message', 'captcha')
        self.assertFalse(res['success'])
        for key in form_keys:
            self.assertIn(key, res['error'])
Example #3
0
def contact_post(context, request):
    return handle_contact_form(request)