@@ 273-298 (lines=26) @@ | ||
270 | ) |
|
271 | ||
272 | ||
273 | def test_default_user_config_overwrite(mocker, cli_runner, user_config_path): |
|
274 | mock_cookiecutter = mocker.patch( |
|
275 | 'cookiecutter.cli.cookiecutter' |
|
276 | ) |
|
277 | ||
278 | template_path = 'tests/fake-repo-pre/' |
|
279 | result = cli_runner( |
|
280 | template_path, |
|
281 | '--config-file', |
|
282 | user_config_path, |
|
283 | '--default-config', |
|
284 | ) |
|
285 | ||
286 | assert result.exit_code == 0 |
|
287 | mock_cookiecutter.assert_called_once_with( |
|
288 | template_path, |
|
289 | None, |
|
290 | False, |
|
291 | replay=False, |
|
292 | overwrite_if_exists=False, |
|
293 | output_dir='.', |
|
294 | config_file=user_config_path, |
|
295 | default_config=True, |
|
296 | extra_context=None, |
|
297 | password=None, |
|
298 | directory=None, |
|
299 | ) |
|
300 | ||
301 | ||
@@ 302-322 (lines=21) @@ | ||
299 | ) |
|
300 | ||
301 | ||
302 | def test_default_user_config(mocker, cli_runner): |
|
303 | mock_cookiecutter = mocker.patch( |
|
304 | 'cookiecutter.cli.cookiecutter' |
|
305 | ) |
|
306 | ||
307 | template_path = 'tests/fake-repo-pre/' |
|
308 | result = cli_runner(template_path, '--default-config') |
|
309 | ||
310 | assert result.exit_code == 0 |
|
311 | mock_cookiecutter.assert_called_once_with( |
|
312 | template_path, |
|
313 | None, |
|
314 | False, |
|
315 | replay=False, |
|
316 | overwrite_if_exists=False, |
|
317 | output_dir='.', |
|
318 | config_file=None, |
|
319 | default_config=True, |
|
320 | extra_context=None, |
|
321 | password=None, |
|
322 | directory=None, |
|
323 | ) |
|
324 | ||
325 | ||
@@ 249-269 (lines=21) @@ | ||
246 | return str(tmpdir.join('tests/config.yaml')) |
|
247 | ||
248 | ||
249 | def test_user_config(mocker, cli_runner, user_config_path): |
|
250 | mock_cookiecutter = mocker.patch( |
|
251 | 'cookiecutter.cli.cookiecutter' |
|
252 | ) |
|
253 | ||
254 | template_path = 'tests/fake-repo-pre/' |
|
255 | result = cli_runner(template_path, '--config-file', user_config_path) |
|
256 | ||
257 | assert result.exit_code == 0 |
|
258 | mock_cookiecutter.assert_called_once_with( |
|
259 | template_path, |
|
260 | None, |
|
261 | False, |
|
262 | replay=False, |
|
263 | overwrite_if_exists=False, |
|
264 | output_dir='.', |
|
265 | config_file=user_config_path, |
|
266 | default_config=False, |
|
267 | extra_context=None, |
|
268 | password=None, |
|
269 | directory=None, |
|
270 | ) |
|
271 | ||
272 | ||
@@ 209-229 (lines=21) @@ | ||
206 | return str(tmpdir.mkdir('output')) |
|
207 | ||
208 | ||
209 | def test_cli_output_dir(mocker, cli_runner, output_dir_flag, output_dir): |
|
210 | mock_cookiecutter = mocker.patch( |
|
211 | 'cookiecutter.cli.cookiecutter' |
|
212 | ) |
|
213 | ||
214 | template_path = 'tests/fake-repo-pre/' |
|
215 | result = cli_runner(template_path, output_dir_flag, output_dir) |
|
216 | ||
217 | assert result.exit_code == 0 |
|
218 | mock_cookiecutter.assert_called_once_with( |
|
219 | template_path, |
|
220 | None, |
|
221 | False, |
|
222 | replay=False, |
|
223 | overwrite_if_exists=False, |
|
224 | output_dir=output_dir, |
|
225 | config_file=None, |
|
226 | default_config=False, |
|
227 | extra_context=None, |
|
228 | password=None, |
|
229 | directory=None, |
|
230 | ) |
|
231 | ||
232 |