Test cloning a repository with a specific commit hash. Given a valid URL and a commit hash: When ``clone_repo`` is called, Then the repository should be cloned and checked out at that commit.
(repo_exists_true: AsyncMock, run_command_mock: AsyncMock)
| 36 | |
| 37 | @pytest.mark.asyncio |
| 38 | async def test_clone_with_commit(repo_exists_true: AsyncMock, run_command_mock: AsyncMock) -> None: |
| 39 | """Test cloning a repository with a specific commit hash. |
| 40 | |
| 41 | Given a valid URL and a commit hash: |
| 42 | When ``clone_repo`` is called, |
| 43 | Then the repository should be cloned and checked out at that commit. |
| 44 | """ |
| 45 | expected_call_count = GIT_INSTALLED_CALLS + 3 # ensure_git_installed + clone + fetch + checkout |
| 46 | commit_hash = "a" * 40 # Simulating a valid commit hash |
| 47 | clone_config = CloneConfig( |
| 48 | url=DEMO_URL, |
| 49 | local_path=LOCAL_REPO_PATH, |
| 50 | commit=commit_hash, |
| 51 | branch="main", |
| 52 | ) |
| 53 | |
| 54 | await clone_repo(clone_config) |
| 55 | |
| 56 | repo_exists_true.assert_any_call(clone_config.url, token=None) |
| 57 | assert_standard_calls(run_command_mock, clone_config, commit=commit_hash) |
| 58 | assert run_command_mock.call_count == expected_call_count |
| 59 | |
| 60 | |
| 61 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected