Skip to content

Commit 9045e6a

Browse files
author
Saurabh Kumar
committed
Add test for set_key
1 parent 4b8c723 commit 9045e6a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ def test_get_key():
2222
assert success is None
2323

2424

25+
def test_set_key(dotenv_file):
26+
success, key_to_set, value_to_set = dotenv.set_key(dotenv_path, 'HELLO', 'WORLD')
27+
success, key_to_set, value_to_set = dotenv.set_key(dotenv_path, 'foo', 'bar')
28+
dotenv.get_key(dotenv_path, 'HELLO') == 'WORLD'
29+
30+
success, key_to_set, value_to_set = dotenv.set_key(dotenv_path, 'HELLO', 'WORLD 2')
31+
dotenv.get_key(dotenv_path, 'HELLO') == 'WORLD 2'
32+
dotenv.get_key(dotenv_path, 'foo') == 'bar'
33+
34+
2535
def test_list(cli, dotenv_file):
2636
success, key_to_set, value_to_set = dotenv.set_key(dotenv_file, 'HELLO', 'WORLD')
2737
result = cli.invoke(dotenv_cli, ['--file', dotenv_file, 'list'])

0 commit comments

Comments
 (0)