Test: Corrected recurrence testing for confirmation

This commit is contained in:
Paul Beckingham 2015-08-14 07:36:34 -04:00
parent 8b68f7317c
commit 5f2fc6c5b6

View file

@ -320,24 +320,14 @@ class TestBug955(TestCase):
Previously bug.955.t
"""
# With confirmation:off the first "n\n" has no effect.
self.t.config("confirmation", "off")
self.validate()
def test_no_prompt_for_parent_on_child_delete_confirmation_on(self):
"""Deleting a child of a recurring task prompts for parent deletion (confirmation:on)
Previously bug.955.t
"""
self.t.config("confirmation", "on")
self.validate()
def validate(self):
code, out, err = self.t("2 delete", input="n\ny\n")
self.assertIn("Deleting task 2", out)
self.assertIn("Deleted 1 task", out)
# 1 task remains.
code, out, err = self.t("ls")
self.assertRegexpMatches(out, re.compile("^1 task", re.MULTILINE))
@ -351,6 +341,30 @@ class TestBug955(TestCase):
code, out, err = self.t.runError("ls")
self.assertIn("No matches", err)
def test_no_prompt_for_parent_on_child_delete_confirmation_on(self):
"""Deleting a child of a recurring task prompts for parent deletion (confirmation:on)
Previously bug.955.t
"""
# With confirmation:on the first "n\n" is obeyed.
self.t.config("confirmation", "on")
code, out, err = self.t.runError("2 delete", input="n\ny\n")
self.assertIn("Deleted 0 tasks.", out)
# 2 tasks intact.
code, out, err = self.t("ls")
self.assertRegexpMatches(out, re.compile("^2 tasks", re.MULTILINE))
code, out, err = self.t("2 delete", input="y\ny\n")
self.assertIn("Deleted 2 tasks", out)
code, out, err = self.t.runError("all status:recurring")
self.assertIn("No matches", err)
code, out, err = self.t.runError("ls")
self.assertIn("No matches", err)
class TestUpgradeToRecurring(TestCase):
def setUp(self):
"""Executed before each test in the class"""