Skip to content

Commit 89507b6

Browse files
Fixed test_initializer.py
1 parent 0a9b407 commit 89507b6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test_initializer.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class TestInitializerFunction(unittest.TestCase):
1616
@patch("not_gitmodules.core.read_yaml")
1717
def test_initializer_with_valid_yaml(self, mock_read_yaml, mock_file):
1818
mock_read_yaml.return_value = {
19-
"file_manager": f"{module_for_test}",
19+
"file_manager": {
20+
"main": module_for_test
21+
}
2022
}
2123

2224
initializer("notgitmodules.yaml")
@@ -27,7 +29,11 @@ def test_initializer_with_valid_yaml(self, mock_read_yaml, mock_file):
2729
@patch("builtins.print")
2830
@patch("subprocess.run")
2931
def test_initializer_with_invalid_yaml(self, mock_subprocess, mock_print, mock_read_yaml, mock_file):
30-
mock_read_yaml.return_value = {"file_manager": "invalid_repo"}
32+
mock_read_yaml.return_value = {
33+
"file_manager": {
34+
"broken": "invalid_repo"
35+
}
36+
}
3137

3238
mock_subprocess.side_effect = subprocess.CalledProcessError(
3339
returncode=1, cmd="git clone", stderr="error"
@@ -36,12 +42,13 @@ def test_initializer_with_invalid_yaml(self, mock_subprocess, mock_print, mock_r
3642
initializer("notgitmodules.yaml")
3743

3844
expected_calls = [
39-
call("Directory 'my_gitmodules/file_manager' already exists. Skipping..."),
45+
call("Directory 'my_gitmodules/file_manager/broken' already exists. Skipping..."),
4046
call("Failed to clone invalid_repo: error"),
4147
]
4248

4349
self.assertTrue(any(call in mock_print.mock_calls for call in expected_calls))
4450

51+
4552
@patch(
4653
"builtins.open",
4754
new_callable=mock_open,

0 commit comments

Comments
 (0)