b5cba83df4
Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
561 B
Python
16 lines
561 B
Python
from pathlib import Path
|
|
|
|
from packages.config.env_file import read_env_value, update_env_file
|
|
|
|
|
|
def test_update_env_file(tmp_path: Path):
|
|
envf = tmp_path / ".env"
|
|
envf.write_text("FOO=bar\n# comment\nBAZ=old\n", encoding="utf-8")
|
|
update_env_file(envf, {"BAZ": "new", "ADMIN_USERNAME": "alice"})
|
|
text = envf.read_text(encoding="utf-8")
|
|
assert "FOO=bar" in text
|
|
assert "BAZ=new" in text
|
|
assert "ADMIN_USERNAME=alice" in text
|
|
assert read_env_value(envf, "BAZ") == "new"
|
|
assert read_env_value(envf, "ADMIN_USERNAME") == "alice"
|