Skip to content

Commit f10c15a

Browse files
committed
update test
1 parent 97fdbb8 commit f10c15a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎tests/test_main.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,17 @@ def test_load_dotenv_decrypts_with_neighboring_key_file(tmp_path, monkeypatch):
7777

7878
assert load_dotenv(env_path) is True
7979
assert os.environ["SECRET"] == "World"
80+
81+
82+
def test_load_dotenv_decrypts_with_process_environment_only(tmp_path, monkeypatch):
83+
env_path = tmp_path / ".env"
84+
env_path.write_text(
85+
f"DOTENV_PUBLIC_KEY={PUBLIC_KEY}\nSECRET={ENCRYPTED_WORLD}\n",
86+
encoding="utf-8",
87+
)
88+
monkeypatch.setenv("DOTENV_PRIVATE_KEY", PRIVATE_KEY)
89+
monkeypatch.delenv("SECRET", raising=False)
90+
91+
assert not (tmp_path / ".env.keys").exists()
92+
assert load_dotenv(env_path) is True
93+
assert os.environ["SECRET"] == "World"

0 commit comments

Comments
 (0)