Test cloning a repository with submodules included. Given a valid URL and ``include_submodules=True``: When ``clone_repo`` is called, Then the repository should be cloned with ``--recurse-submodules`` in the git command.
(run_command_mock: AsyncMock)
| 305 | |
| 306 | @pytest.mark.asyncio |
| 307 | async def test_clone_with_include_submodules(run_command_mock: AsyncMock) -> None: |
| 308 | """Test cloning a repository with submodules included. |
| 309 | |
| 310 | Given a valid URL and ``include_submodules=True``: |
| 311 | When ``clone_repo`` is called, |
| 312 | Then the repository should be cloned with ``--recurse-submodules`` in the git command. |
| 313 | """ |
| 314 | # ensure_git_installed + resolve_commit + clone + fetch + checkout + checkout submodules |
| 315 | expected_call_count = GIT_INSTALLED_CALLS + 5 |
| 316 | clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH, branch="main", include_submodules=True) |
| 317 | |
| 318 | await clone_repo(clone_config) |
| 319 | |
| 320 | assert_standard_calls(run_command_mock, clone_config, commit=DEMO_COMMIT) |
| 321 | assert_submodule_calls(run_command_mock, clone_config) |
| 322 | assert run_command_mock.call_count == expected_call_count |
| 323 | |
| 324 | |
| 325 | def assert_standard_calls(mock: AsyncMock, cfg: CloneConfig, commit: str, *, partial_clone: bool = False) -> None: |
nothing calls this directly
no test coverage detected