Commit 64f1ad6a authored by Jacek Sowiński's avatar Jacek Sowiński

Fix tests for 'del' and 'do'

Adjust to changes introduced in: 3f096
parent 3f09644c
......@@ -133,11 +133,22 @@ class DeleteCommandTest(CommandTest.CommandTest):
self.assertEquals(self.todolist.count(), 0)
def test_multi_del3(self):
""" Test deletion of multiple items. """
""" Fail if any of supplied todo numbers is invalid. """
command = DeleteCommand(["99", "2"], self.todolist, self.out, self.error, _yes_prompt)
command.execute()
self.assertEquals(self.todolist.count(), 1)
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, "")
self.assertEquals(self.errors, "Invalid todo number given: 99.\n")
def test_multi_del4(self):
""" Check output when all supplied todo numbers are invalid. """
command = DeleteCommand(["99", "A"], self.todolist, self.out, self.error, _yes_prompt)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, "")
self.assertEquals(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: A.\n")
def test_empty(self):
command = DeleteCommand([], self.todolist, self.out, self.error)
......
......@@ -312,20 +312,17 @@ class DoCommandTest(CommandTest.CommandTest):
command = DoCommand(["99", "3"], self.todolist, self.out, self.error, _no_prompt)
command.execute()
self.assertTrue(self.todolist.todo(3).is_completed())
self.assertEquals(self.output, "Completed: x {} Baz p:1\n".format(self.today))
self.assertEquals(self.errors, "Invalid todo number given.\n")
self.assertFalse(self.todolist.todo(3).is_completed())
self.assertEquals(self.errors, "Invalid todo number given: 99.\n")
def test_multi_do5(self):
"""
When a todo item was generated by a recurring todo item, make sure
it cannot be completed in the same invocation.
Check output when all supplied todo numbers are invalid.
"""
command = DoCommand(["4", "10"], self.todolist, self.out, self.error, _no_prompt)
command = DoCommand(["99", "10"], self.todolist, self.out, self.error, _no_prompt)
command.execute()
self.assertTrue(self.todolist.todo(4).is_completed())
self.assertFalse(self.todolist.todo(10).is_completed())
self.assertEquals(self.errors, "Invalid todo number given: 99.\nInvalid todo number given: 10.\n")
def test_invalid_recurrence(self):
""" Show error message when an item has an invalid recurrence pattern. """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment