Skip to content

Commit efb8865

Browse files
committed
update
1 parent 4e0bec0 commit efb8865

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

libs/agno/tests/unit/tools/test_todoist_tools.py

+32-17
Original file line numberDiff line numberDiff line change
@@ -130,29 +130,44 @@ def test_get_task_success(todoist_tools, mock_todoist_api):
130130

131131
def test_update_task_success(todoist_tools, mock_todoist_api):
132132
"""Test successful task update."""
133-
mock_task = Mock()
134-
mock_task.id = "123"
135-
mock_task.content = "Updated Task"
136-
mock_task.description = "Updated Description"
137-
mock_task.project_id = "project_1"
138-
mock_task.section_id = None
139-
mock_task.parent_id = None
140-
mock_task.order = 1
141-
mock_task.priority = 1
142-
mock_task.url = "https://todoist.com/task/123"
143-
mock_task.comment_count = 0
144-
mock_task.creator_id = "user_1"
145-
mock_task.created_at = "2024-01-01T10:00:00Z"
146-
mock_task.labels = []
147-
mock_task.due = None
148-
133+
# Create a simple object to represent the task
134+
class MockTask:
135+
def __init__(self):
136+
self.__dict__ = {
137+
"id": "123",
138+
"content": "Updated Task",
139+
"description": "Updated Description",
140+
"project_id": "project_1",
141+
"section_id": None,
142+
"parent_id": None,
143+
"order": 1,
144+
"priority": 1,
145+
"url": "https://todoist.com/task/123",
146+
"comment_count": 0,
147+
"creator_id": "user_1",
148+
"created_at": "2024-01-01T10:00:00Z",
149+
"labels": [],
150+
"due": None
151+
}
152+
153+
mock_task = MockTask()
149154
mock_todoist_api.update_task.return_value = mock_task
150155

151156
result = todoist_tools.update_task("123", content="Updated Task")
152157
result_data = json.loads(result)
153158

154159
assert result_data["id"] == "123"
155-
mock_todoist_api.update_task.assert_called_once_with(task_id="123", content="Updated Task")
160+
assert result_data["content"] == "Updated Task"
161+
assert result_data["project_id"] == "project_1"
162+
163+
# Verify the API was called with correct parameters
164+
mock_todoist_api.update_task.assert_called_once_with(
165+
task_id="123",
166+
content="Updated Task",
167+
due_string=None,
168+
priority=None,
169+
labels=None
170+
)
156171

157172

158173
def test_close_task_success(todoist_tools, mock_todoist_api):

0 commit comments

Comments
 (0)