mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
[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:
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user