change max lenght
This commit is contained in:
@@ -134,7 +134,9 @@ class TestCloneOrPull:
|
||||
"""Test cloning a new repository."""
|
||||
mock_clone.return_value = MagicMock()
|
||||
|
||||
result = git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/repo.git")
|
||||
result = git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git"
|
||||
)
|
||||
|
||||
assert result == git_repo.cache_dir / "test-source"
|
||||
mock_clone.assert_called_once()
|
||||
@@ -159,7 +161,9 @@ class TestCloneOrPull:
|
||||
mock_repo.remotes.origin = mock_origin
|
||||
mock_repo_class.return_value = mock_repo
|
||||
|
||||
result = git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/repo.git")
|
||||
result = git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git"
|
||||
)
|
||||
|
||||
assert result == repo_path
|
||||
mock_origin.pull.assert_called_once_with("main")
|
||||
@@ -179,7 +183,9 @@ class TestCloneOrPull:
|
||||
mock_repo_class.return_value = mock_repo
|
||||
|
||||
result = git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git", token="ghp_token123"
|
||||
source_name="test-source",
|
||||
git_url="https://github.com/org/repo.git",
|
||||
token="ghp_token123",
|
||||
)
|
||||
|
||||
# Verify URL was updated with token
|
||||
@@ -198,7 +204,9 @@ class TestCloneOrPull:
|
||||
|
||||
mock_clone.return_value = MagicMock()
|
||||
|
||||
git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/repo.git", force_refresh=True)
|
||||
git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git", force_refresh=True
|
||||
)
|
||||
|
||||
# Verify clone was called (not pull)
|
||||
mock_clone.assert_called_once()
|
||||
@@ -208,7 +216,9 @@ class TestCloneOrPull:
|
||||
"""Test cloning with custom branch."""
|
||||
mock_clone.return_value = MagicMock()
|
||||
|
||||
git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/repo.git", branch="develop")
|
||||
git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git", branch="develop"
|
||||
)
|
||||
|
||||
call_kwargs = mock_clone.call_args[1]
|
||||
assert call_kwargs["branch"] == "develop"
|
||||
@@ -221,10 +231,14 @@ class TestCloneOrPull:
|
||||
@patch("skill_seekers.mcp.git_repo.git.Repo.clone_from")
|
||||
def test_clone_auth_failure_error(self, mock_clone, git_repo):
|
||||
"""Test authentication failure error handling."""
|
||||
mock_clone.side_effect = GitCommandError("clone", 128, stderr="fatal: Authentication failed")
|
||||
mock_clone.side_effect = GitCommandError(
|
||||
"clone", 128, stderr="fatal: Authentication failed"
|
||||
)
|
||||
|
||||
with pytest.raises(GitCommandError, match="Authentication failed"):
|
||||
git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/repo.git")
|
||||
git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/repo.git"
|
||||
)
|
||||
|
||||
@patch("skill_seekers.mcp.git_repo.git.Repo.clone_from")
|
||||
def test_clone_not_found_error(self, mock_clone, git_repo):
|
||||
@@ -232,7 +246,9 @@ class TestCloneOrPull:
|
||||
mock_clone.side_effect = GitCommandError("clone", 128, stderr="fatal: repository not found")
|
||||
|
||||
with pytest.raises(GitCommandError, match="Repository not found"):
|
||||
git_repo.clone_or_pull(source_name="test-source", git_url="https://github.com/org/nonexistent.git")
|
||||
git_repo.clone_or_pull(
|
||||
source_name="test-source", git_url="https://github.com/org/nonexistent.git"
|
||||
)
|
||||
|
||||
|
||||
class TestFindConfigs:
|
||||
|
||||
Reference in New Issue
Block a user