Commit c2037fc8 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add method to mark a list as completed from TodoList.

This will mark the todo list dirty.
parent 42dba297
......@@ -280,6 +280,11 @@ class TodoList(object):
def todos(self):
return self._todos
def set_todo_completed(self, p_number):
todo = self.todo(p_number)
todo.set_completed()
self.dirty = True
def __str__(self):
return '\n'.join(pretty_print(self._todos))
......@@ -142,6 +142,10 @@ class TodoListTester(unittest.TestCase):
self.assertIsInstance(todo, Todo.Todo)
self.assertEquals(todo.text(), "No number")
def test_todo_complete(self):
self.todolist.set_todo_completed(1)
self.assertTrue(self.todolist.todo(1).is_completed())
class TodoListDependencyTester(unittest.TestCase):
def setUp(self):
self.todolist = TodoList.TodoList([])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment