test_flask.py 529 Bytes
from flask import Flask, render_template
from flask_testing import TestCase
import unittest

class RootTest(TestCase):

  render_templates = True

  def create_app(self):
    app = Flask(__name__)
    app.config['Testing'] = True

    @app.route('/')
    def main():
      return render_template('index.html')
    
    return app
  
  def test_something(self):
    response = self.client.get("/")
    self.assertEqual(response.data.decode('utf-8'),"Nothing to see here...",response)


if __name__ == "__main__":
  unittest.main()