def test_invalid_template(self):
     """Establish that an invalid object being sent down as a
     template raises TypeError.
     """
     req = self.rf.get('/foo')
     with self.assertRaises(TypeError):
         response = JinjaTemplateResponse(req, object())
         response.render()
 def test_template_list(self):
     """Establish that a list of templates is processed correctly,
     with the first valid match chosen.
     """
     req = self.rf.get('/foo')
     response = JinjaTemplateResponse(req, ['bogus.html', 'jinja.html'], {
         'add': lambda *a: sum(a),
         'foo': { 'bar': 'spam' },
     })
     response.render()
     self.assertEqual(response.content, '12\nspam'.encode('utf8'))