title: Newb to Writing Integration Tests
body: <p>Here is my test file:</p>
  <pre><code>from flask import Flask
  from flask.ext.testing import TestCase
  
  
  class TestInitViews(TestCase):
  
      render_templates = False
  
      def create_app(self):
          app = Flask(__name__)
          app.config['TESTING'] = True
          return app
  
      def test_root_route(self):
          self.client.get('/')
          self.assert_template_used('index.html')
  </code></pre>
  <p>Here is the full stack trace:</p>
  <pre><code>$ nosetests tests/api/client/test_init_views.py
  F
  ======================================================================
  FAIL: test_root_route (tests.api.client.test_init_views.TestInitViews)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File &quot;/Users/dmonsewicz/dev/autoresponders/tests/api/client/test_init_views.py&quot;, line 17, in test_root_route
      self.assert_template_used('index.html')
    File &quot;/Users/dmonsewicz/.virtualenvs/autoresponders-api/lib/python2.7/site-packages/flask_testing.py&quot;, line 120, in assertTemplateUsed
      raise AssertionError(&quot;template %s not used&quot; % name)
  AssertionError: template index.html not used
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.012s
  
  FAILED (failures=1)
  </code></pre>
  <p>I am a newb to Python and can't seem to figure this one out. All I am trying to do is write a simple test that hits the <code>/</code> (root route) endpoint and <code>asserts</code> that the template used was in fact <code>index.html</code></p>
  <p>Attempt at using <code>LiveServerTestCase</code></p>
  <pre><code>from flask import Flask
  from flask.ext.testing import LiveServerTestCase
  
  
  class TestInitViews(LiveServerTestCase):
  
      render_templates = False
  
      def create_app(self):
          app = Flask(__name__)
          app.config['TESTING'] = True
          app.config['LIVESERVER_PORT'] = 6765
  
          return app
  
      def setUp(self):
          self.app = self.app.test_client()
  
      def test_root_route(self):
          res = self.app.get('/')
  
          print(res)
  
          self.assert_template_used('index.html')
  </code></pre>
  <p>I'm using <code>Flask-Testing</code> version <code>0.4</code> and for some reason the <code>LiveServerTestCase</code> doesn't exist in my import</p>
  <h1>Working Code</h1>
  <pre><code>from flask import Flask
  from flask.ext.testing import TestCase
  from api.client import blueprint
  
  
  class TestInitViews(TestCase):
  
      render_templates = False
  
      def create_app(self):
          app = Flask(__name__)
          app.config['TESTING'] = True
  
          app.register_blueprint(blueprint)
  
          return app
  
      def test_root_route(self):
          res = self.client.get('/')
          self.assert_template_used('index.html')
  </code></pre>