Flask blueprint unit-testing

Blueprints are very similar to application. I guess that you want test test_client requests.

If you want test blueprint as part of your application then look like no differences there are with application.

If you want test blueprint as extension then you can create test application with own blueprint and test it.


I did the following if this helps anyone. I basically made the test file my Flask application

from flask import Flask
import unittest

app = Flask(__name__)

from blueprint_file import blueprint
app.register_blueprint(blueprint, url_prefix='')

class BluePrintTestCase(unittest.TestCase):

    def setUp(self):
        self.app = app.test_client()

    def test_health(self):
        rv = self.app.get('/blueprint_path')
        print rv.data


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