def test_empty(self): command = DeleteCommand([], self.todolist, self.out, self.error) command.execute() self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.output) self.assertEquals(self.errors, command.usage() + "\n")
def test_multi_del3(self): """ Test deletion of multiple items. """ command = DeleteCommand(["99", "2"], self.todolist, self.out, self.error, _yes_prompt) command.execute() self.assertEquals(self.todolist.count(), 1)
def test_del8(self): command = DeleteCommand(["A"], self.todolist, self.out, self.error) command.execute() self.assertFalse(self.todolist.is_dirty()) self.assertEquals(self.output, "") self.assertEquals(self.errors, "Invalid todo number given.\n")
def test_del1_regex(self): command = DeleteCommand(["Foo"], self.todolist, self.out, self.error, _no_prompt) command.execute() self.assertTrue(self.todolist.is_dirty()) self.assertEquals(self.todolist.todo(1).source(), "Bar") self.assertEquals(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEquals(self.errors, "")
def test_del9(self): """ Test deletion with textual IDs. """ config("test/data/todolist-uid.conf") command = DeleteCommand(["b0n"], self.todolist, self.out, self.error) command.execute() self.assertEquals(str(self.todolist), "Foo") self.assertRaises(InvalidTodoException, self.todolist.todo, 'b0n')
def test_del4(self): command = DeleteCommand(["--force", "1"], self.todolist, self.out, self.error, _yes_prompt) command.execute() self.assertTrue(self.todolist.is_dirty()) self.assertEquals(self.todolist.count(), 1) # force won't delete subtasks self.assertEquals(self.output, "| 2| Bar p:1\nRemoved: Foo id:1\n") self.assertEquals(self.errors, "")
def test_del2(self): command = DeleteCommand(["1"], self.todolist, self.out, self.error, _yes_prompt) command.execute() self.assertTrue(self.todolist.is_dirty()) self.assertEquals(self.todolist.count(), 0) self.assertEquals(self.output, "| 2| Bar p:1\nRemoved: Bar\nRemoved: Foo\n") self.assertEquals(self.errors, "")
def test_del5(self): command = DeleteCommand(["2"], self.todolist, self.out, self.error) command.execute() self.assertTrue(self.todolist.is_dirty()) self.assertEquals(self.todolist.todo(1).source(), "Foo") self.assertEquals( self.output, "Removed: Bar p:1\nThe following todo item(s) became active:\n| 1| Foo\n" ) self.assertEquals(self.errors, "")
def test_help(self): command = DeleteCommand(["help"], self.todolist, self.out, self.error) command.execute() self.assertEquals(self.output, "") self.assertEquals(self.errors, command.usage() + "\n\n" + command.help() + "\n")