feat: 增强日历功能并集成 AgentScope 代理服务
This commit is contained in:
@@ -10,45 +10,6 @@ from models.friendships import Friendship, FriendshipStatus
|
||||
from models.inbox_messages import InboxMessage, InboxMessageStatus, InboxMessageType
|
||||
|
||||
|
||||
class FakeFriendshipRepository:
|
||||
"""Fake implementation for testing."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.friendships: dict[uuid.UUID, Friendship] = {}
|
||||
self.inbox_messages: dict[uuid.UUID, InboxMessage] = {}
|
||||
|
||||
async def create_request(
|
||||
self,
|
||||
initiator_id: uuid.UUID,
|
||||
recipient_id: uuid.UUID,
|
||||
) -> tuple[Friendship, InboxMessage]:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_friendship_between_users(
|
||||
self, user_id_1: uuid.UUID, user_id_2: uuid.UUID
|
||||
) -> Friendship | None:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_pending_inbox_for_recipient(
|
||||
self, recipient_id: uuid.UUID, friendship_id: uuid.UUID
|
||||
) -> InboxMessage | None:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_friendship_by_id(self, friendship_id: uuid.UUID) -> Friendship | None:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_inbox_messages_for_user(
|
||||
self, user_id: uuid.UUID, status: InboxMessageStatus | None = None
|
||||
) -> list[InboxMessage]:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_outgoing_requests(self, user_id: uuid.UUID) -> list[Friendship]:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_friends_list(self, user_id: uuid.UUID) -> list[Friendship]:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class TestFriendshipRepository:
|
||||
"""Tests for FriendshipRepository."""
|
||||
|
||||
@@ -112,12 +73,18 @@ class TestFriendshipRepository:
|
||||
|
||||
mock_session.execute = AsyncMock(side_effect=mock_execute_func)
|
||||
|
||||
friendship, inbox = await repository.create_request(initiator_id, recipient_id)
|
||||
content = "你好,我是测试用户"
|
||||
friendship, inbox = await repository.create_request(
|
||||
initiator_id,
|
||||
recipient_id,
|
||||
content,
|
||||
)
|
||||
|
||||
assert friendship is not None
|
||||
assert inbox is not None
|
||||
assert friendship.initiator_id == initiator_id
|
||||
assert inbox.recipient_id == recipient_id
|
||||
assert inbox.content == content
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_friendship_between_users_returns_friendship(
|
||||
|
||||
Reference in New Issue
Block a user