MCPcopy
hub / github.com/coderamp-labs/gitingest / test_clone_commit

Function test_clone_commit

tests/test_clone.py:175–189  ·  view source on GitHub ↗

Test cloning when a commit hash is provided. 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.

(run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

173
174@pytest.mark.asyncio
175async def test_clone_commit(run_command_mock: AsyncMock) -> None:
176 """Test cloning when a commit hash is provided.
177
178 Given a valid URL and a commit hash:
179 When ``clone_repo`` is called,
180 Then the repository should be cloned and checked out at that commit.
181 """
182 expected_call_count = GIT_INSTALLED_CALLS + 3 # ensure_git_installed + clone + fetch + checkout
183 commit_hash = "a" * 40 # Simulating a valid commit hash
184 clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH, commit=commit_hash)
185
186 await clone_repo(clone_config)
187
188 assert_standard_calls(run_command_mock, clone_config, commit=commit_hash)
189 assert run_command_mock.call_count == expected_call_count
190
191
192@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

CloneConfigClass · 0.90
clone_repoFunction · 0.90
assert_standard_callsFunction · 0.85

Tested by

no test coverage detected