| 1 | import pytest |
| 2 | from flask import Flask as _Flask |
| 3 | |
| 4 | |
| 5 | class Flask(_Flask): |
| 6 | testing = True |
| 7 | secret_key = __name__ |
| 8 | |
| 9 | def make_response(self, rv): |
| 10 | if rv is None: |
| 11 | rv = "" |
| 12 | |
| 13 | return super().make_response(rv) |
| 14 | |
| 15 | |
| 16 | @pytest.fixture |
| 17 | def app(): |
| 18 | app = Flask(__name__) |
| 19 | return app |
| 20 | |
| 21 | |
| 22 | @pytest.fixture |
| 23 | def app_ctx(app): |
| 24 | with app.app_context() as ctx: |
| 25 | yield ctx |
| 26 | |
| 27 | |
| 28 | @pytest.fixture |
| 29 | def req_ctx(app): |
| 30 | with app.test_request_context() as ctx: |
| 31 | yield ctx |
| 32 | |
| 33 | |
| 34 | @pytest.fixture |
| 35 | def client(app): |
| 36 | return app.test_client() |