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

Function test_clone_without_commit

tests/test_clone.py:62–76  ·  view source on GitHub ↗

Test cloning a repository when no commit hash is provided. Given a valid URL and no commit hash: When ``clone_repo`` is called, Then only the clone_repo operation should be performed (no checkout).

(repo_exists_true: AsyncMock, run_command_mock: AsyncMock)

Source from the content-addressed store, hash-verified

60
61@pytest.mark.asyncio
62async def test_clone_without_commit(repo_exists_true: AsyncMock, run_command_mock: AsyncMock) -> None:
63 """Test cloning a repository when no commit hash is provided.
64
65 Given a valid URL and no commit hash:
66 When ``clone_repo`` is called,
67 Then only the clone_repo operation should be performed (no checkout).
68 """
69 expected_call_count = GIT_INSTALLED_CALLS + 4 # ensure_git_installed + resolve_commit + clone + fetch + checkout
70 clone_config = CloneConfig(url=DEMO_URL, local_path=LOCAL_REPO_PATH, commit=None, branch="main")
71
72 await clone_repo(clone_config)
73
74 repo_exists_true.assert_any_call(clone_config.url, token=None)
75 assert_standard_calls(run_command_mock, clone_config, commit=DEMO_COMMIT)
76 assert run_command_mock.call_count == expected_call_count
77
78
79@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