Skip to main content
Glama

Aidderall MCP Server

by cheezcake
test_models.py3.55 kB
# Aidderall MCP Server - Hierarchical task management for AI assistants # Copyright (C) 2024 Briam R. <briamr@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. from datetime import datetime import pytest from src.models import MainTask, SubTask, Task, TaskStatus class TestModels: def test_task_creation(self): task = MainTask(title="Test Task", body="Test body") assert task.title == "Test Task" assert task.body == "Test body" assert task.status == TaskStatus.PENDING assert task.id is not None assert isinstance(task.created_at, datetime) assert task.completed_at is None def test_task_title_validation(self): with pytest.raises( ValueError, match="Task title must be 256 characters or less" ): MainTask(title="x" * 257, body="Test body") def test_main_task_sub_tasks(self): main_task = MainTask(title="Main", body="Main body") sub_task1 = SubTask(title="Sub 1", body="Sub body 1") sub_task2 = SubTask(title="Sub 2", body="Sub body 2") main_task.add_sub_task(sub_task1) main_task.add_sub_task(sub_task2) assert len(main_task.sub_tasks) == 2 assert main_task.sub_tasks[0] == sub_task1 assert main_task.sub_tasks[1] == sub_task2 def test_get_rightmost_task(self): main_task = MainTask(title="Main", body="Main body") assert main_task.get_rightmost_task() == main_task sub_task1 = SubTask(title="Sub 1", body="Sub body 1") sub_task2 = SubTask(title="Sub 2", body="Sub body 2") main_task.add_sub_task(sub_task1) assert main_task.get_rightmost_task() == sub_task1 main_task.add_sub_task(sub_task2) assert main_task.get_rightmost_task() == sub_task2 def test_has_incomplete_sub_tasks(self): main_task = MainTask(title="Main", body="Main body") assert not main_task.has_incomplete_sub_tasks() sub_task1 = SubTask(title="Sub 1", body="Sub body 1") main_task.add_sub_task(sub_task1) assert main_task.has_incomplete_sub_tasks() sub_task1.status = TaskStatus.COMPLETED assert not main_task.has_incomplete_sub_tasks() sub_task2 = SubTask(title="Sub 2", body="Sub body 2") main_task.add_sub_task(sub_task2) assert main_task.has_incomplete_sub_tasks() def test_remove_rightmost_sub_task(self): main_task = MainTask(title="Main", body="Main body") assert main_task.remove_rightmost_sub_task() is None sub_task1 = SubTask(title="Sub 1", body="Sub body 1") sub_task2 = SubTask(title="Sub 2", body="Sub body 2") main_task.add_sub_task(sub_task1) main_task.add_sub_task(sub_task2) removed = main_task.remove_rightmost_sub_task() assert removed == sub_task2 assert len(main_task.sub_tasks) == 1 assert main_task.sub_tasks[0] == sub_task1

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cheezcake/aidderall_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server