You're POSTing the form instance, rather than the postedData. So:
response = self.client.post('/myApp/post', form) should be: response = self.client.post('/myApp/post/', postedData) More info here: http://docs.djangoproject.com/en/dev/topics/testing/#making-requests On Mar 28, 9:14 pm, tsmets <tsm...@gmail.com> wrote: > I was wondering how I could test / unittest form posting ? > > class TestSomeRequest(TestCase): > > def testCallDefaultDpasteURL(self): > response = self.client.get('/my_app/') > self.failUnlessEqual(response.status_code, 200) > > def testCallDpasteAboutURL(self): > postedData = { > 'poster' : 'test', > 'code' : SIMPLE_POST, > 'comment' : 'No comment' > } > form = forms.CodePostForm(postedData) > response = self.client.post('/myApp/post', form) > self.failUnlessEqual(response.status_code, 200) > > This does not seems OK ??? > Any hint would be appreciated > > \T, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---