From 4a7262d3da950845d5674cac0326596eedc14087 Mon Sep 17 00:00:00 2001 From: Andre Hora Date: Tue, 31 Jan 2023 11:07:18 -0300 Subject: [PATCH] improving test_cli by adding test_enable_dotenv_from_env tests --- tests/test_cli.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 0d9625b1..472e0751 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -562,6 +562,30 @@ def test_disable_dotenv_from_env(monkeypatch, runner): assert "FOO" not in os.environ +@need_dotenv +def test_enable_dotenv_from_env_zero(monkeypatch, runner): + monkeypatch.chdir(test_path) + monkeypatch.setitem(os.environ, "FLASK_SKIP_DOTENV", "0") + runner.invoke(FlaskGroup()) + assert "FOO" in os.environ + + +@need_dotenv +def test_enable_dotenv_from_env_false(monkeypatch, runner): + monkeypatch.chdir(test_path) + monkeypatch.setitem(os.environ, "FLASK_SKIP_DOTENV", "FALSE") + runner.invoke(FlaskGroup()) + assert "FOO" in os.environ + + +@need_dotenv +def test_enable_dotenv_from_env_no(monkeypatch, runner): + monkeypatch.chdir(test_path) + monkeypatch.setitem(os.environ, "FLASK_SKIP_DOTENV", "NO") + runner.invoke(FlaskGroup()) + assert "FOO" in os.environ + + def test_run_cert_path(): # no key with pytest.raises(click.BadParameter):