I'll post a full example in bitbucket and then a slice :)

On Mar 2, 2:30 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Would you post a web2pyslice?
>
> On Mar 2, 4:39 am, Jon Romero <darks...@gmail.com> wrote:
>
> > ok I managed to do unit testing on forms:
>
> >  def testForm(self):
> >         request.vars["username"] = "great-guy"
> >         request.vars["email"] = "b...@bla.com"
>
> >         request.vars["_formname"] = "bla_create" #this is the form
> > name
>
> >         resp = index()
>
> >         self.assertTrue(resp['form'].errors) # do we have errors?
> >         self.assertEquals(1, len(resp["all_users"]))
>
> > On Mar 1, 2:20 pm, Jon Romero <darks...@gmail.com> wrote:
>
> > > Good job!
>
> > > I am still having problem withunittestingforms. It seems that I
> > > cannot do a post.
>
> > >         # Set variables for the test function
> > >         request.env.request_method = 'POST'
> > >         request.post_vars["body"] = "body"
> > >         #request.vars = Storage(body = "bodyyyy")
>
> > >         resp = index()
> > >         print "vars", resp['form']
>
> > >         #self.assertTrue(resp['form'].errors) # do we have errors?
> > >         #self.assertTrue(resp['form'].errors.has_key('name')) # is
> > > something missing?
>
> > > Any ideas?
>
> > > On Feb 25, 11:15 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>
> > > > I'm really glad to see this work happening, and I look forward to the 
> > > > slice.
>
> > > > Perhaps we could eventually haveunittests as part of the welcome app, 
> > > > or indeed all three standard apps, both for documentation purposes and 
> > > > to set a good example.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to