Esempio n. 1
0
 def test_user_add_view_not_validated(self):
     """ Test the response of the `user_add` view not validated."""
     from anuket.views.user import user_add_view
     request = AnuketDummyRequest()
     request.method = 'POST'  # required for form.validate()
     request.params['form_submitted'] = u''
     response = user_add_view(request)
     from pyramid_simpleform.renderers import FormRenderer
     self.assertIsInstance(response['renderer'], FormRenderer)
Esempio n. 2
0
 def test_user_add_view_not_validated(self):
     """ Test the response of the `user_add` view not validated."""
     from anuket.views.user import user_add_view
     request = AnuketDummyRequest()
     request.method = 'POST'  # required for form.validate()
     request.params['form_submitted'] = u''
     response = user_add_view(request)
     from pyramid_simpleform.renderers import FormRenderer
     self.assertIsInstance(response['renderer'], FormRenderer)
Esempio n. 3
0
 def test_user_add_view(self):
     """ Test the response of the `user_add` view."""
     self.dummy_group_fixture()
     password = self.password_fixture()
     from anuket.views.user import user_add_view
     request = AnuketDummyRequest()
     request.method = 'POST'  # required for form.validate()
     request.params['form_submitted'] = u''
     request.params['username'] = u'username'
     request.params['first_name'] = u'firstname'
     request.params['last_name'] = u'lastname'
     request.params['email'] = u'*****@*****.**'
     request.params['group_id'] = 1
     request.params['password'] = password
     request.params['password_confirm'] = password
     response = user_add_view(request)
     self.assertEqual(response.location, '/tools/user')
     self.assertEqual(request.session.pop_flash('success')[0],
                      u"User added.")
Esempio n. 4
0
 def test_user_add_view(self):
     """ Test the response of the `user_add` view."""
     self.dummy_group_fixture()
     password = self.password_fixture()
     from anuket.views.user import user_add_view
     request = AnuketDummyRequest()
     request.method = 'POST'  # required for form.validate()
     request.params['form_submitted'] = u''
     request.params['username'] = u'username'
     request.params['first_name'] = u'firstname'
     request.params['last_name'] = u'lastname'
     request.params['email'] = u'*****@*****.**'
     request.params['group_id'] = 1
     request.params['password'] = password
     request.params['password_confirm'] = password
     response = user_add_view(request)
     self.assertEqual(response.location, '/tools/user')
     self.assertEqual(
         request.session.pop_flash('success')[0], u"User added.")