Skip to content
Myr

Parameterize test_get_debug_flag

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by MikeTheReader · committed by MikeTheReader · parent fd4a363 · Browse files · 1 file+14 added−20 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+14 added−20 removed

  • tests:+14 added−20 removed

1 file+14 added−20 removed

modified:tests/test_helpers.py+14 added-20 removed
943 unmodified lines
944 print(flask.safe_join(*args))945946class TestHelpers(object):947948 def test_get_debug_flag(self, monkeypatch):949 monkeypatch.setenv('FLASK_DEBUG', '')950 assert get_debug_flag() == None951 assert get_debug_flag(default=True) == True948 @pytest.mark.parametrize("debug, expected_flag, expected_default_flag", [949 ('', None, True),950 ('0', False, False),951 ('False', False, False),952 ('No', False, False),953 ('True', True, True)954 ])955 def test_get_debug_flag(self, monkeypatch, debug, expected_flag, expected_default_flag):956 monkeypatch.setenv('FLASK_DEBUG', debug)957 if expected_flag is None:958 assert get_debug_flag() is None959 else:960 assert get_debug_flag() == expected_flag961 assert get_debug_flag(default=True) == expected_default_flag962953 monkeypatch.setenv('FLASK_DEBUG', '0')954 assert get_debug_flag() == False955 assert get_debug_flag(default=True) == False956957 monkeypatch.setenv('FLASK_DEBUG', 'False')958 assert get_debug_flag() == False959 assert get_debug_flag(default=True) == False960961 monkeypatch.setenv('FLASK_DEBUG', 'No')962 assert get_debug_flag() == False963 assert get_debug_flag(default=True) == False964965 monkeypatch.setenv('FLASK_DEBUG', 'True')966 assert get_debug_flag() == True967 assert get_debug_flag(default=True) == True968963 def test_make_response(self):964 app = flask.Flask(__name__)965 with app.test_request_context():966 rv = flask.helpers.make_response()
7 unmodified lines