9
9
# `runner` and `isolated_mock_files`
10
10
11
11
12
- @patch ("envcloak.commands.generate_key .add_to_gitignore" )
12
+ @patch ("envcloak.utils .add_to_gitignore" )
13
13
@patch ("envcloak.commands.generate_key.generate_key_file" )
14
14
def test_generate_key_with_gitignore (
15
15
mock_generate_key_file , mock_add_to_gitignore , runner , isolated_mock_files
@@ -31,10 +31,7 @@ def mock_create_key_file(output_path):
31
31
result = runner .invoke (main , ["generate-key" , "--output" , str (temp_key_file )])
32
32
33
33
# 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 )
38
35
39
36
# Cleanup
40
37
if temp_key_file .exists ():
@@ -65,15 +62,15 @@ def mock_create_key_file(output_path):
65
62
)
66
63
67
64
# 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 )
69
66
mock_add_to_gitignore .assert_not_called ()
70
67
71
68
# Cleanup
72
69
if temp_key_file .exists ():
73
70
temp_key_file .unlink ()
74
71
75
72
76
- @patch ("envcloak.commands.generate_key_from_password .add_to_gitignore" )
73
+ @patch ("envcloak.utils .add_to_gitignore" )
77
74
@patch ("envcloak.commands.generate_key_from_password.generate_key_from_password_file" )
78
75
def test_generate_key_from_password_with_gitignore (
79
76
mock_generate_key_from_password_file ,
@@ -112,10 +109,7 @@ def mock_create_key_from_password(password, output_path, salt):
112
109
113
110
# Assertions
114
111
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
119
113
)
120
114
121
115
# Cleanup
@@ -165,7 +159,7 @@ def mock_create_key_from_password(password, output_path, salt):
165
159
166
160
# Assertions
167
161
mock_generate_key_from_password_file .assert_called_once_with (
168
- password , temp_key_file , salt
162
+ password , temp_key_file , False , salt
169
163
)
170
164
mock_add_to_gitignore .assert_not_called ()
171
165
0 commit comments