You can use unittest.TestCase.assertRegexpMatches for checking if form is
present in rendered template.
If you want to check the entire cycle (form loading, filling) you can use
selenium for testing on live server.

On Wed, 4 Nov 2015 at 22:08 Tim Chase <django.us...@tim.thechases.com>
wrote:

> Beginning a new project, I'd like to include functional testing in
> addition to my unit tests.  What are recommended best practices for
> exercising form-classes?  I was hoping to do something like
>
>   c = django.test.Client()
>   results = c.get(page_url)
>   frm = SomeForm()
>   # pseudo-code for desired functional testing follows
>   self.assertFormIn(frm, results) # check the form is used
>   frm["name"] = "Pat Smith"
>   frm["email"] = "psm...@example.com"
>   results = c.post(page_url, frm) # submit the filled-out form
>   # check results for error messages and/or success here
>
> Is there some piece of Django that I've missed that would facilitate
> higher-level tests like this?
>
> Thanks,
>
> -tkc
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20151104103632.38e014a4%40bigbox.christie.dr
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAByqUgj%2BeqyPr5b%2BVSu9AJ_45QZ5UgyrUn3G3pmxpSsN9SvHVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to