mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix for delete conversation (#6097)
This commit is contained in:
parent
aad7a612c1
commit
eaf4c610b2
@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import TypeAdapter
|
||||
|
||||
@ -39,7 +40,9 @@ class FileConversationStore(ConversationStore):
|
||||
return result
|
||||
|
||||
async def delete_metadata(self, conversation_id: str) -> None:
|
||||
path = self.get_conversation_metadata_filename(conversation_id)
|
||||
path = str(
|
||||
Path(self.get_conversation_metadata_filename(conversation_id)).parent
|
||||
)
|
||||
await call_sync_from_async(self.file_store.delete, path)
|
||||
|
||||
async def exists(self, conversation_id: str) -> bool:
|
||||
|
||||
@ -6,6 +6,7 @@ from unittest.mock import MagicMock, patch
|
||||
import pytest
|
||||
|
||||
from openhands.server.routes.manage_conversations import (
|
||||
delete_conversation,
|
||||
get_conversation,
|
||||
search_conversations,
|
||||
update_conversation,
|
||||
@ -114,3 +115,16 @@ async def test_update_conversation():
|
||||
selected_repository='foobar',
|
||||
)
|
||||
assert conversation == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_conversation():
|
||||
with _patch_store():
|
||||
await delete_conversation(
|
||||
'some_conversation_id',
|
||||
MagicMock(state=MagicMock(github_token='')),
|
||||
)
|
||||
conversation = await get_conversation(
|
||||
'some_conversation_id', MagicMock(state=MagicMock(github_token=''))
|
||||
)
|
||||
assert conversation is None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user