¡Esta es una revisión vieja del documento!
import urllib2 from flask import Flask from flask.ext.testing import LiveServerTestCase class MyTest(LiveServerTestCase): def create_app(self): app = Flask(__name__) app.config['TESTING'] = True # Default port is 5000 app.config['LIVESERVER_PORT'] = 8943 return app def test_server_is_up_and_running(self): response = urllib2.urlopen(self.get_server_url()) self.assertEqual(response.code, 200)
You need to set render_templates to False. Also use assert_template_used to know if the template was rendered.
class TestNotRenderTemplates(TestCase): render_templates = False def test_assert_mytemplate_used(self): response = self.client.get("/template/") self.assert_template_used('mytemplate.html')