def test_add_dep9(self): """ The text ID shown after adding and after an 'ls' must be equal." By appending the parent's projects, the textual ID may change. """ config("test/data/todolist-uid-projects.conf") # pass identitiy function to for writing output, we're not interested # in this output command = AddCommand.AddCommand(["Foo +Project"], self.todolist, lambda t: t, self.error) command.execute() command = AddCommand.AddCommand(["Bar before:eqk"], self.todolist, self.out, self.error) command.execute() command = ListCommand.ListCommand(["Bar"], self.todolist, self.out, self.error) command.execute() self.assertEquals( self.output, "|5dh| {today} Bar p:1 +Project\n|5dh| {today} Bar +Project\n". format(today=self.today))
def test_add_dep3(self): command = AddCommand.AddCommand(["Foo"], self.todolist) command.execute() command = AddCommand.AddCommand(["Bar after:1"], self.todolist, self.out, self.error) command.execute() self.assertEquals( self.todolist.todo(1).source(), self.today + " Foo p:1") self.assertEquals( self.todolist.todo(2).source(), self.today + " Bar id:1") self.assertEquals(self.errors, "")
def test_add_empty(self): command = AddCommand.AddCommand([], self.todolist, self.out, self.error) command.execute() self.assertEquals(self.output, "") self.assertEquals(self.errors, command.usage() + "\n")
def test_help(self): command = AddCommand.AddCommand(["help"], self.todolist, self.out, self.error) command.execute() self.assertEquals(self.output, "") self.assertEquals(self.errors, command.usage() + "\n\n" + command.help() + "\n")
def test_add_dep8(self): config("test/data/todolist-uid.conf") command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error) command.execute() command = AddCommand.AddCommand(["Bar after:tpi"], self.todolist, self.out, self.error) command.execute() self.assertEquals( self.todolist.todo('tpi').source(), "{} Foo p:1".format(self.today)) self.assertEquals( self.todolist.todo('b0n').source(), "{} Bar id:1".format(self.today))
def test_add_priority4(self): command = AddCommand.AddCommand(["(C) Foo"], self.todolist, self.out, self.error) command.execute() self.assertEquals(self.todolist.todo(1).priority(), 'C') self.assertEquals( self.todolist.todo(1).source(), "(C) " + self.today + " Foo") self.assertEquals(self.errors, "")
def test_add_priority3(self): command = AddCommand.AddCommand(["Fo(C)o"], self.todolist, self.out, self.error) command.execute() self.assertEquals(self.todolist.todo(1).priority(), None) self.assertEquals( self.todolist.todo(1).source(), self.today + " Fo(C)o") self.assertEquals(self.errors, "")
def test_add_multiple_args(self): args = ["New", "todo"] command = AddCommand.AddCommand(args, self.todolist, self.out, self.error) command.execute() self.assertEquals( self.todolist.todo(1).source(), self.today + " New todo") self.assertEquals(self.errors, "")
def test_add_reldate2(self): command = AddCommand.AddCommand(["Foo t:today due:today"], self.todolist, self.out, self.error) command.execute() result = "| 1| {} Foo t:{} due:{}\n".format(self.today, self.today, self.today) self.assertEquals(self.output, result) self.assertEquals(self.errors, "")
def test_add_reldate1(self): command = AddCommand.AddCommand(["Foo due:today"], self.todolist, self.out, self.error) command.execute() self.assertEquals( self.todolist.todo(1).source(), self.today + " Foo due:" + self.today) self.assertEquals(self.errors, "")
def test_add_dep6(self): command = AddCommand.AddCommand(["Foo"], self.todolist, self.out, self.error) command.execute() command = AddCommand.AddCommand(["Bar"], self.todolist, self.out, self.error) command.execute() command = AddCommand.AddCommand(["Baz before:1 before:2"], self.todolist, self.out, self.error) command.execute() self.assertEquals( self.todolist.todo(1).source(), self.today + " Foo id:1") self.assertEquals( self.todolist.todo(2).source(), self.today + " Bar id:2") self.assertEquals( self.todolist.todo(3).source(), self.today + " Baz p:1 p:2") self.assertEquals(self.errors, "")
def test_add_dep5(self): """ Test for using an after: tag with non-existing value. """ command = AddCommand.AddCommand(["Foo after:2"], self.todolist, self.out, self.error) command.execute() self.assertFalse(self.todolist.todo(1).has_tag("after")) self.assertEquals(self.todolist.todo(1).source(), self.today + " Foo") self.assertEquals(self.output, "| 1| " + str(self.todolist.todo(1)) + "\n") self.assertEquals(self.errors, "")