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")
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")
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")
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())
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)
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")
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")
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, "")
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, "")
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, "")
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")
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, "")
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, "")
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, "")
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, "")
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, "")
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, "")
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"))
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" )
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, "")
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")
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)
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())
def test_depri_name(self): name = DepriCommand.name() self.assertEqual(name, 'depri')