File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -108,15 +108,27 @@ def mock_get_config_path():
108
108
config = json .load (f )
109
109
assert config == utils .DEFAULT_CONFIG
110
110
111
- def test_init_skips_when_config_exists (self , cli_env , capfd ):
111
+ def test_init_skips_when_config_exists (self , cli_env , capfd , monkeypatch ):
112
112
"""Test that 'init' command skips creation when config already exists."""
113
+ config_path = Path (cli_env ["config_path" ])
114
+
115
+ # Mock get_config_path to return our test config
116
+ def mock_get_config_path ():
117
+ return config_path
118
+ monkeypatch .setattr (utils , "get_config_path" , mock_get_config_path )
119
+
120
+ # Mock Path.exists to return True
121
+ def mock_exists (self ):
122
+ return True
123
+ monkeypatch .setattr (Path , "exists" , mock_exists )
124
+
113
125
# Execute init command
114
126
args = mock .Mock ()
115
127
commands .init_command (args )
116
128
117
129
# Verify output indicates config already exists
118
130
out , _ = capfd .readouterr ()
119
- assert "already exists" in out
131
+ assert f "already exists" in out
120
132
121
133
122
134
class TestCliAdd :
You can’t perform that action at this time.
0 commit comments