[Fix]: Use str in place of Repository for repository param when creating new conversation (#8159)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
Rohit Malhotra
2025-05-02 11:17:04 -04:00
committed by GitHub
parent 7244e5df9f
commit 767d092f8f
22 changed files with 579 additions and 135 deletions

View File

@@ -1,5 +1,7 @@
"""Tests for the setup script."""
from unittest.mock import patch
from conftest import (
_load_runtime,
)
@@ -7,14 +9,27 @@ from conftest import (
from openhands.core.setup import initialize_repository_for_runtime
from openhands.events.action import FileReadAction, FileWriteAction
from openhands.events.observation import FileReadObservation, FileWriteObservation
from openhands.integrations.service_types import ProviderType, Repository
def test_initialize_repository_for_runtime(temp_dir, runtime_cls, run_as_openhands):
"""Test that the initialize_repository_for_runtime function works."""
runtime, config = _load_runtime(temp_dir, runtime_cls, run_as_openhands)
repository_dir = initialize_repository_for_runtime(
runtime, 'https://github.com/All-Hands-AI/OpenHands'
mock_repo = Repository(
id=1232,
full_name='All-Hands-AI/OpenHands',
git_provider=ProviderType.GITHUB,
is_public=True,
)
with patch(
'openhands.runtime.base.ProviderHandler.verify_repo_provider',
return_value=mock_repo,
):
repository_dir = initialize_repository_for_runtime(
runtime, selected_repository='All-Hands-AI/OpenHands'
)
assert repository_dir is not None
assert repository_dir == 'OpenHands'