'Asserts that the template with the provided name was used in rendering
the response.'

def assertTemplateUsed(self, response, template_name, msg_prefix=''):

    if msg_prefix:
        msg_prefix += ':    '
    template_names = [t.name for t in to_list(response.template)]
    if (not template_names):
        self.fail((msg_prefix + 'No    templates    used    to    render    the    response'))
    self.assertTrue((template_name in template_names), (msg_prefix + ("Template    '%s'    was    not    a    template    used    to    render    the    response.    Actual    template(s)    used:    %s" % (template_name, u',    '.join(template_names)))))
