The way I've tested it in the past is: GET the page, using the client. Scrape the values you need. (BeautifulSoup makes this really easy, but you can do it with python's builtin stdlib I guess.) POST the comment message, along with all the values you just scraped.
Hope that helps, Alex On May 25, 10:41 am, Thierry <thierryschellenb...@gmail.com> wrote: > How do you guys test implementations of the django comment framework? > A regular post doesnt seem to work because it depends on data from a > previous get. > An thoughts? > > def test_comment(self): > item_url = reverse('item', args=['4558']) > self.client.login(username=self.username, > password=self.password) > import datetime > test_message = 'test at %s' % datetime.datetime.today() > item_view = self.client.get(item_url) > comment_submit = self.client.post(item_url, {'comment': > test_message}) > test = open('test.html', 'w') > import os > print dir(test) > print test.name > print os.path.abspath(test.name) > > test.write(unicode(comment_submit)) > item_view = self.client.get(item_url) > self.assertContains(item_view, test_message) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.