Skip to content

Commit e00f6ad

Browse files
committed
Merge branch 'feature/quiet' into develop
2 parents 9d41845 + f967448 commit e00f6ad

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

tests/test_cli_generate_key.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# `runner` and `isolated_mock_files`
1010

1111

12-
@patch("envcloak.commands.generate_key.add_to_gitignore")
12+
@patch("envcloak.utils.add_to_gitignore")
1313
@patch("envcloak.commands.generate_key.generate_key_file")
1414
def test_generate_key_with_gitignore(
1515
mock_generate_key_file, mock_add_to_gitignore, runner, isolated_mock_files
@@ -31,10 +31,7 @@ def mock_create_key_file(output_path):
3131
result = runner.invoke(main, ["generate-key", "--output", str(temp_key_file)])
3232

3333
# Assertions
34-
mock_generate_key_file.assert_called_once_with(temp_key_file)
35-
mock_add_to_gitignore.assert_called_once_with(
36-
temp_key_file.parent, temp_key_file.name
37-
)
34+
mock_generate_key_file.assert_called_once_with(temp_key_file, False)
3835

3936
# Cleanup
4037
if temp_key_file.exists():
@@ -65,15 +62,15 @@ def mock_create_key_file(output_path):
6562
)
6663

6764
# Assertions
68-
mock_generate_key_file.assert_called_once_with(temp_key_file)
65+
mock_generate_key_file.assert_called_once_with(temp_key_file, False)
6966
mock_add_to_gitignore.assert_not_called()
7067

7168
# Cleanup
7269
if temp_key_file.exists():
7370
temp_key_file.unlink()
7471

7572

76-
@patch("envcloak.commands.generate_key_from_password.add_to_gitignore")
73+
@patch("envcloak.utils.add_to_gitignore")
7774
@patch("envcloak.commands.generate_key_from_password.generate_key_from_password_file")
7875
def test_generate_key_from_password_with_gitignore(
7976
mock_generate_key_from_password_file,
@@ -112,10 +109,7 @@ def mock_create_key_from_password(password, output_path, salt):
112109

113110
# Assertions
114111
mock_generate_key_from_password_file.assert_called_once_with(
115-
password, temp_key_file, salt
116-
)
117-
mock_add_to_gitignore.assert_called_once_with(
118-
temp_key_file.parent, temp_key_file.name
112+
password, temp_key_file, False, salt
119113
)
120114

121115
# Cleanup
@@ -165,7 +159,7 @@ def mock_create_key_from_password(password, output_path, salt):
165159

166160
# Assertions
167161
mock_generate_key_from_password_file.assert_called_once_with(
168-
password, temp_key_file, salt
162+
password, temp_key_file, False, salt
169163
)
170164
mock_add_to_gitignore.assert_not_called()
171165

tests/test_other_gitignore.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_add_to_gitignore_existing_file(tmp_path, capsys):
1717
gitignore_path.write_text(existing_content, encoding="utf-8")
1818

1919
# Call the function to add a new filename
20-
add_to_gitignore(str(directory), filename)
20+
add_to_gitignore(str(directory), filename, False)
2121

2222
# Verify that the filename was appended
2323
updated_content = gitignore_path.read_text(encoding="utf-8")
@@ -49,7 +49,7 @@ def test_add_to_gitignore_already_listed(tmp_path, capsys):
4949
gitignore_path.write_text(existing_content, encoding="utf-8")
5050

5151
# Call the function
52-
add_to_gitignore(str(directory), filename)
52+
add_to_gitignore(str(directory), filename, False)
5353

5454
# Verify that the content remains unchanged
5555
updated_content = gitignore_path.read_text(encoding="utf-8")

0 commit comments

Comments
 (0)