Esempio n. 1
0
    def test_empty(self):
        command = DepriCommand([], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, command.usage() + "\n")
Esempio n. 2
0
    def test_help(self):
        command = DepriCommand(["help"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
Esempio n. 3
0
    def test_invalid1(self):
        command = DepriCommand(["99"], 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 given.\n")
Esempio n. 4
0
    def test_expr_depri4(self):
        """ Don't remove priority from unrelevant todo items. """
        command = DepriCommand(["-e", "Bax"], self.todolist, self.out,
                               self.error, None)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
Esempio n. 5
0
    def test_expr_depri4(self):
        """ Don't remove priority from unrelevant todo items. """
        command = DepriCommand(["-e", "Bax"], self.todolist, self.out,
                               self.error, None)
        command.execute()

        self.assertFalse(self.todolist.dirty)
Esempio n. 6
0
    def test_empty(self):
        command = DepriCommand([], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertFalse(self.output)
        self.assertEqual(self.errors, command.usage() + "\n")
Esempio n. 7
0
    def test_invalid1(self):
        command = DepriCommand(["99"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors, "Invalid todo number given.\n")
Esempio n. 8
0
    def test_depri3(self):
        command = DepriCommand(["Foo"], self.todolist, self.out, self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(1).priority(), None)
        self.assertEqual(self.output, "Priority removed.\n|  1| Foo\n")
        self.assertEqual(self.errors, "")
Esempio n. 9
0
    def test_depri2(self):
        command = DepriCommand(["2"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(2).priority(), None)
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, "")
Esempio n. 10
0
    def test_depri3(self):
        command = DepriCommand(["Foo"], self.todolist, self.out, self.error)
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.todolist.todo(1).priority(), None)
        self.assertEqual(self.output, "Priority removed.\n|  1| Foo\n")
        self.assertEqual(self.errors, "")
Esempio n. 11
0
    def test_invalid3(self):
        command = DepriCommand(["99", "FooBar"], 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 given: 99.\nInvalid todo number given: FooBar.\n")
Esempio n. 12
0
    def test_depri2(self):
        command = DepriCommand(["2"], self.todolist, self.out, self.error)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertEqual(self.todolist.todo(2).priority(), None)
        self.assertEqual(self.output, "")
        self.assertEqual(self.errors, "")
Esempio n. 13
0
    def test_expr_depri5(self):
        """ Force unprioritizing unrelevant items with additional -x flag. """
        command = DepriCommand(["-xe", "Bax"], self.todolist, self.out,
                               self.error, None)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, "Priority removed.\n|  6| Bax id:1\n")
        self.assertEqual(self.errors, "")
Esempio n. 14
0
    def test_expr_depri5(self):
        """ Force unprioritizing unrelevant items with additional -x flag. """
        command = DepriCommand(["-xe", "Bax"], self.todolist, self.out,
                               self.error, None)
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output, "Priority removed.\n|  6| Bax id:1\n")
        self.assertEqual(self.errors, "")
Esempio n. 15
0
    def test_expr_depri2(self):
        command = DepriCommand(["-e", "@test", "due:2015-06-03"],
                               self.todolist, self.out, self.error, None)
        command.execute()

        result = "Priority removed.\n|  4| a @test with due:2015-06-03\n"

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
Esempio n. 16
0
    def test_depri4(self):
        command = DepriCommand(["1", "Baz"], self.todolist, self.out,
                               self.error)
        command.execute()

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.todolist.todo(1).priority(), None)
        self.assertEqual(self.todolist.todo(3).priority(), None)
        self.assertEqual(self.output, "Priority removed.\n|  1| Foo\nPriority removed.\n|  3| Baz\n")
        self.assertEqual(self.errors, "")
Esempio n. 17
0
    def test_expr_depri2(self):
        command = DepriCommand(["-e", "@test", "due:2015-06-03"],
                               self.todolist, self.out, self.error, None)
        command.execute()

        result = "Priority removed.\n|  4| a @test with due:2015-06-03\n"

        self.assertTrue(self.todolist.is_dirty())
        self.assertEqual(self.output, result)
        self.assertEqual(self.errors, "")
Esempio n. 18
0
    def test_invalid4(self):
        """ Throw an error with invalid argument containing special characters. """
        command = DepriCommand([u("Fo\u00d3B\u0105r"), "Bar"], self.todolist,
                               self.out, self.error, None)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
        self.assertFalse(self.output)
        self.assertEqual(self.errors,
                         u("Invalid todo number given: Fo\u00d3B\u0105r.\n"))
Esempio n. 19
0
    def test_invalid3(self):
        command = DepriCommand(["99", "FooBar"], self.todolist, self.out,
                               self.error)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(
            self.errors,
            "Invalid todo number given: 99.\nInvalid todo number given: FooBar.\n"
        )
Esempio n. 20
0
    def test_depri4(self):
        command = DepriCommand(["1", "Baz"], self.todolist, self.out,
                               self.error)
        command.execute()

        self.assertTrue(self.todolist.dirty)
        self.assertEqual(self.todolist.todo(1).priority(), None)
        self.assertEqual(self.todolist.todo(3).priority(), None)
        self.assertEqual(
            self.output,
            "Priority removed.\n|  1| Foo\nPriority removed.\n|  3| Baz\n")
        self.assertEqual(self.errors, "")
Esempio n. 21
0
    def test_invalid4(self):
        """
        Throw an error with invalid argument containing special characters.
        """
        command = DepriCommand([u"Fo\u00d3B\u0105r", "Bar"], self.todolist,
                               self.out, self.error, None)
        command.execute()

        self.assertFalse(self.todolist.dirty)
        self.assertFalse(self.output)
        self.assertEqual(self.errors,
                         u"Invalid todo number given: Fo\u00d3B\u0105r.\n")
Esempio n. 22
0
    def test_help(self):
        command = DepriCommand(["help"], self.todolist, self.out, self.error)
        command.execute()

        self.assertEqual(self.output, "")
        self.assertEqual(self.errors,
                         command.usage() + "\n\n" + command.help() + "\n")
Esempio n. 23
0
    def test_expr_depri3(self):
        command = DepriCommand(["-e", "@test", "due:2015-06-03", "+project"],
                               self.todolist, self.out, self.error, None)
        command.execute()

        self.assertFalse(self.todolist.dirty)
Esempio n. 24
0
    def test_expr_depri3(self):
        command = DepriCommand(["-e", "@test", "due:2015-06-03", "+project"],
                               self.todolist, self.out, self.error, None)
        command.execute()

        self.assertFalse(self.todolist.is_dirty())
Esempio n. 25
0
    def test_depri_name(self):
        name = DepriCommand.name()

        self.assertEqual(name, 'depri')
Esempio n. 26
0
    def test_depri_name(self):
        name = DepriCommand.name()

        self.assertEqual(name, 'depri')