Commit 6cf62225 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add test for ArchiveCommand.

parent 3f59dae7
......@@ -8,4 +8,4 @@ class ArchiveCommand(Command.Command):
def execute(self):
for todo in [t for t in self.todolist.todos() if t.is_completed()]:
self.archive.add_todo(todo)
self.todolist.delete(self.todolist.number(todo))
self.todolist.delete(todo)
import ArchiveCommand
import CommandTest
import TestFacilities
import TodoList
class ArchiveCommandTest(CommandTest.CommandTest):
def test_archive(self):
todolist = TestFacilities.load_file_to_todolist("data/ArchiveCommandTest.txt")
archive = TodoList.TodoList([])
command = ArchiveCommand.ArchiveCommand(todolist, archive)
command.execute()
self.assertTrue(todolist.is_dirty())
self.assertTrue(archive.is_dirty())
self.assertEquals(str(todolist), "x Not complete\n(C) Active")
self.assertEquals(str(archive), "x 2014-10-19 Complete\nx 2014-10-20 Another one complete")
x 2014-10-19 Complete
x 2014-10-20 Another one complete
x Not complete
(C) Active
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