Modifications based on review
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by MikeTheReader · committed by MikeTheReader · parent 6f49089 · Browse files · 1 file·+15 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+15 added−29 removed
- tests:+15 added−29 removed
Provenance
- Commit
fd4a363- Tree
0b30796- Author
MikeTheReader <MLundin617@gmail.com>- Committer
MikeTheReader <MLundin617@gmail.com>- Parent
6f49089
1 file changed+15 added−29 removed
modified:tests/test_helpers.py+15 added-29 removed
943 unmodified lines944 print(flask.safe_join(*args))945 946 class TestHelpers(object):947 948- def test_get_debug_flag(self):949- original_debug_value = os.environ.get('FLASK_DEBUG') or ''950- os.environ['FLASK_DEBUG'] = ''948+ def test_get_debug_flag(self, monkeypatch):949+ monkeypatch.setenv('FLASK_DEBUG', '')950 assert get_debug_flag() == None951 assert get_debug_flag(default=True) == True952 954- os.environ['FLASK_DEBUG'] = '0'953+ monkeypatch.setenv('FLASK_DEBUG', '0')954 assert get_debug_flag() == False955 assert get_debug_flag(default=True) == False956 958- os.environ['FLASK_DEBUG'] = 'False'957+ monkeypatch.setenv('FLASK_DEBUG', 'False')958 assert get_debug_flag() == False959 assert get_debug_flag(default=True) == False960 962- os.environ['FLASK_DEBUG'] = 'No'961+ monkeypatch.setenv('FLASK_DEBUG', 'No')962 assert get_debug_flag() == False963 assert get_debug_flag(default=True) == False964 966- os.environ['FLASK_DEBUG'] = 'True'965+ monkeypatch.setenv('FLASK_DEBUG', 'True')966 assert get_debug_flag() == True967 assert get_debug_flag(default=True) == True968 970- os.environ['FLASK_DEBUG'] = original_debug_value971-972- def test_make_response_no_args(self):969+ def test_make_response(self):970 app = flask.Flask(__name__)974- app.testing = True975- @app.route('/')976- def index():977- return flask.helpers.make_response()978- c = app.test_client()979- rv = c.get()980- assert rv971+ with app.test_request_context():972+ rv = flask.helpers.make_response()973+ assert rv.status_code == 200974+ assert rv.mimetype == 'text/html'975 982- def test_make_response_with_args(self):983- app = flask.Flask(__name__)984- app.testing = True985- @app.route('/')986- def index():987- response = flask.helpers.make_response(flask.render_template_string('Hello World'))988- response.headers['X-Parachutes'] = 'parachutes are cool'989- return response990- c = app.test_client()991- rv = c.get()992- assert rv993- assert rv.headers['X-Parachutes'] == 'parachutes are cool'976+ rv = flask.helpers.make_response('Hello')977+ assert rv.status_code == 200978+ assert rv.data == b'Hello'979+ assert rv.mimetype == 'text/html'