예제 #1
0
    def test_rm_tag2(self):
        command = TagCommand(["2", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output, "|  2| Bar\n")
        self.assertEqual(self.errors, "")
예제 #2
0
    def test_rm_tag10(self):
        command = TagCommand(["-f", "4", "due"], self.todolist, self.out, self.error, lambda t: "A")
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output, "|  4| Fnord\n")
        self.assertEqual(self.errors, "")
예제 #3
0
    def test_rm_tag1(self):
        command = TagCommand(["1", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertEqual(self.output, "|  1| Foo\n")
        self.assertEqual(self.errors, "")
예제 #4
0
    def test_add_tag4(self):
        command = TagCommand(["Foox", "due", "2014-10-22"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Invalid todo number.\n")
예제 #5
0
    def test_no_tag(self):
        command = TagCommand(["4"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, command.usage() + "\n")
예제 #6
0
    def test_set_tag7(self):
        command = TagCommand(["4", "due", "2014-10-20"], self.todolist, self.out, self.error, lambda t: "2")
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n|  4| Fnord due:2014-10-20 due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #7
0
    def test_set_tag4(self):
        command = TagCommand(["3", "due", "2014-10-20"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #8
0
    def test_rm_tag02(self):
        command = TagCommand(["2", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  2| Bar\n")
        self.assertEqual(self.errors, "")
예제 #9
0
    def test_rm_tag01(self):
        command = TagCommand(["1", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, "|  1| Foo\n")
        self.assertEqual(self.errors, "")
예제 #10
0
    def test_rm_tag09(self):
        command = TagCommand(["A", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, "Invalid todo number.\n")
예제 #11
0
    def test_no_tag(self):
        command = TagCommand(["4"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, command.usage() + "\n")
예제 #12
0
    def test_help(self):
        command = TagCommand(["help"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
예제 #13
0
    def test_rm_tag9(self):
        command = TagCommand(["A", "due"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, "Invalid todo number.\n")
예제 #14
0
    def test_set_tag11(self):
        command = TagCommand(["3", "due", "today"], self.todolist, self.out,
                             self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2015-11-19\n")
        self.assertEqual(self.errors, "")
예제 #15
0
    def test_rm_tag07(self):
        command = TagCommand(["4", "due"], self.todolist, self.out, self.error,
                             lambda t: "A")
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n|  4| Fnord due:2014-10-20 due:2014-10-22\n")
        self.assertEqual(self.errors, "")
예제 #16
0
    def test_add_tag2(self):
        command = TagCommand(["Foo", "due", "2014-10-22"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22")
        self.assertEqual(self.output, "|  1| Foo due:2014-10-22\n")
        self.assertEqual(self.errors, "")
        self.assertTrue(self.todolist.is_dirty())
예제 #17
0
    def test_set_tag05(self):
        command = TagCommand(["4", "due", "2014-10-20"], self.todolist,
                             self.out, self.error, lambda t: "all")
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n|  4| Fnord due:2014-10-20 due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #18
0
    def test_rm_tag10(self):
        command = TagCommand(["-f", "4", "due"], self.todolist, self.out,
                             self.error, lambda t: "A")
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  4| Fnord\n")
        self.assertEqual(self.errors, "")
예제 #19
0
    def test_add_tag4(self):
        command = TagCommand(["Foox", "due", "2014-10-22"], self.todolist,
                             self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Invalid todo number.\n")
예제 #20
0
    def test_add_tag3(self):
        command = TagCommand(["-a", "2", "due", "2014-10-19"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.todolist.todo(2).source(), "Bar due:2014-10-22 due:2014-10-19")
        self.assertEqual(self.output, "|  2| Bar due:2014-10-22 due:2014-10-19\n")
        self.assertEqual(self.errors, "")
        self.assertTrue(self.todolist.is_dirty())
예제 #21
0
    def test_set_tag04(self):
        command = TagCommand(["3", "due", "2014-10-20"], self.todolist,
                             self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #22
0
    def test_set_tag11(self):
        command = TagCommand(["3", "due", "today"], self.todolist, self.out,
                             self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2015-11-19\n")
        self.assertEqual(self.errors, "")
예제 #23
0
    def test_rm_tag07(self):
        command = TagCommand(["4", "due"], self.todolist, self.out, self.error,
                             lambda t: "A")
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.output, " 1. 2014-10-20\n 2. 2014-10-22\n|  4| Fnord due:2014-10-20 due:2014-10-22\n")
        self.assertEqual(self.errors, "")
예제 #24
0
    def test_rm_tag03(self):
        command = TagCommand(["4", "due"], self.todolist, self.out,
                             self.error, lambda t: "all")
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output,
                         " 1. 2014-10-20\n 2. 2014-10-22\n|  4| Fnord\n")
        self.assertEqual(self.errors, "")
예제 #25
0
    def test_add_tag2(self):
        command = TagCommand(["Foo", "due", "2014-10-22"], self.todolist,
                             self.out, self.error)
        command.execute()

        self.assertEqual(self.todolist.todo(1).source(), "Foo due:2014-10-22")
        self.assertEqual(self.output, "|  1| Foo due:2014-10-22\n")
        self.assertEqual(self.errors, "")
        self.assertTrue(self.todolist.dirty)
예제 #26
0
    def test_set_tag10(self):
        command = TagCommand(["-f", "4", "due", "2014-10-20"], self.todolist,
                             self.out, self.error, lambda t: "99")
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output,
                         "|  4| Fnord due:2014-10-20 due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #27
0
    def test_set_tag10(self):
        command = TagCommand(["-f", "4", "due", "2014-10-20"], self.todolist,
                             self.out, self.error, lambda t: "99")
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output,
                         "|  4| Fnord due:2014-10-20 due:2014-10-20\n")
        self.assertEqual(self.errors, "")
예제 #28
0
    def test_force_add_tag01(self):
        '''Tries to different values to a tag for the same name 3 times.'''
        for letter in ['a', 'b', 'c']:
            command = TagCommand(['-a', '1', 'k', letter], self.todolist,
                                 self.out, self.error)
            command.execute()

            self.assertEqual(self.errors, "")
            self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(1).source(), "Foo k:a k:b k:c")
예제 #29
0
    def test_force_add_tag01(self):
        '''Tries to different values to a tag for the same name 3 times.'''
        for letter in ['a', 'b', 'c']:
            command = TagCommand(['-a', '1', 'k', letter], self.todolist,
                                 self.out, self.error)
            command.execute()

            self.assertEqual(self.errors, "")
            self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(1).source(), "Foo k:a k:b k:c")
예제 #30
0
    def test_add_tag3(self):
        command = TagCommand(["-a", "2", "due", "2014-10-19"], self.todolist,
                             self.out, self.error)
        command.execute()

        self.assertEqual(self.todolist.todo(2).source(),
                         "Bar due:2014-10-22 due:2014-10-19")
        self.assertEqual(self.output,
                         "|  2| Bar due:2014-10-22 due:2014-10-19\n")
        self.assertEqual(self.errors, "")
        self.assertTrue(self.todolist.dirty)
예제 #31
0
    def test_set_tag12(self):
        """
        Do not convert relative dates for tags that were not configured as
        start/due date.
        """
        command = TagCommand(["3", "foo", "today"], self.todolist, self.out,
                             self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:today\n")
        self.assertEqual(self.errors, "")
예제 #32
0
    def test_set_tag12(self):
        """
        Do not convert relative dates for tags that were not configured as
        start/due date.
        """
        command = TagCommand(["3", "foo", "today"], self.todolist, self.out,
                             self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:today\n")
        self.assertEqual(self.errors, "")
예제 #33
0
    def test_set_tag13(self):
        """
        Convert relative dates when forced to.
        """

        command = TagCommand(["-r", "3", "foo", "today"], self.todolist,
                             self.out, self.error)

        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:2017-01-12\n")
        self.assertEqual(self.errors, "")
예제 #34
0
    def test_set_tag14(self):
        """
        Leave the original value when an invalid relative date was given.
        """

        command = TagCommand(["-r", "3", "foo", "bar"], self.todolist,
                             self.out, self.error)

        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:bar\n")
        self.assertEqual(self.errors, "")
예제 #35
0
    def test_set_tag13(self):
        """
        Convert relative dates when forced to.
        """

        command = TagCommand(["-r", "3", "foo", "today"], self.todolist,
                             self.out, self.error)

        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:2017-01-12\n")
        self.assertEqual(self.errors, "")
예제 #36
0
    def test_set_tag14(self):
        """
        Leave the original value when an invalid relative date was given.
        """

        command = TagCommand(["-r", "3", "foo", "bar"], self.todolist,
                             self.out, self.error)

        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "|  3| Baz due:2014-10-20 foo:bar\n")
        self.assertEqual(self.errors, "")
예제 #37
0
    def test_help(self):
        command = TagCommand(["help"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
예제 #38
0
    def test_tag_name(self):
        name = TagCommand.name()

        self.assertEqual(name, 'tag')
예제 #39
0
    def test_tag_name(self):
        name = TagCommand.name()

        self.assertEqual(name, 'tag')