Esempio n. 1
0
 def test_create_user_form(self, unit):
     unit.drop_db()
     unit.create_db()
     context = CreateResource(User)
     post = [('form.submitted', '1'), ('__formid__', 'deform'),
             ('__start__', ':mapping'), ('id', '1'),
             ('name', 'foo bar baz'), ('__end__', ':mapping')]
     unit.request.POST = OrderedDict(post)
     unit.request.params = OrderedDict(post)
     unit.request.sacrud_prefix = 'sacrud'
     context.renderer = 'json'
     response = Create(context, unit.request).edit_form_post_view()
     assert isinstance(response, HTTPFound)
     user = unit.dbsession.query(User).filter_by(id=1).first()
     assert user.id == 1
     assert user.name == 'foo bar baz'
Esempio n. 2
0
 def test_create_user_form(self, unit):
     unit.drop_db()
     unit.create_db()
     context = CreateResource(User)
     post = [
         ('form.submitted', '1'),
         ('__formid__', 'deform'),
         ('__start__', ':mapping'),
         ('id', '1'),
         ('name', 'foo bar baz'),
         ('__end__', ':mapping')
     ]
     unit.request.POST = OrderedDict(post)
     unit.request.params = OrderedDict(post)
     unit.request.sacrud_prefix = 'sacrud'
     context.renderer = 'json'
     response = Create(context, unit.request).edit_form_post_view()
     assert isinstance(response, HTTPFound)
     user = unit.dbsession.query(User).filter_by(id=1).first()
     assert user.id == 1
     assert user.name == 'foo bar baz'
Esempio n. 3
0
 def test_create_get_form(self, unit):
     context = CreateResource(User)
     context.renderer = 'json'
     response = Create(context, unit.request).edit_form_get_view()
     assert len(response.json['form']) > 0
Esempio n. 4
0
 def test_create_get_form(self, unit):
     context = CreateResource(User)
     context.renderer = 'json'
     response = Create(context, unit.request).edit_form_get_view()
     assert len(response.json['form']) > 0