mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Test: Change most tests to use "add test" instead of split arguments
This commit is contained in:
parent
d711bda35c
commit
27b8cabac1
76 changed files with 1179 additions and 1245 deletions
|
@ -46,11 +46,11 @@ class TestProjects(TestCase):
|
|||
"""'task projects' shouldn't consider deleted tasks in summary.
|
||||
Reported in bug 1044
|
||||
"""
|
||||
self.t(("add", "project:A", "1"))
|
||||
self.t(("add", "project:B", "2"))
|
||||
self.t(("add", "project:B", "3"))
|
||||
self.t(("3", "delete"))
|
||||
code, out, err = self.t(("project:B", "projects"))
|
||||
self.t("add project:A 1")
|
||||
self.t("add project:B 2")
|
||||
self.t("add project:B 3")
|
||||
self.t("3 delete")
|
||||
code, out, err = self.t("project:B projects")
|
||||
|
||||
expected = "1 project \(1 task\)"
|
||||
self.assertRegexpMatches(out, expected)
|
||||
|
@ -58,31 +58,31 @@ class TestProjects(TestCase):
|
|||
def test_project_progress(self):
|
||||
"""project status/progress is shown and is up-to-date"""
|
||||
|
||||
code, out, err = self.t(("add", "one", "pro:foo"))
|
||||
code, out, err = self.t("add one pro:foo")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
|
||||
"1 task"))
|
||||
|
||||
code, out, err = self.t(("add", "two", "pro:foo"))
|
||||
code, out, err = self.t("add two pro:foo")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
|
||||
"2 of 2 tasks"))
|
||||
|
||||
code, out, err = self.t(("add", "three", "pro:foo"))
|
||||
code, out, err = self.t("add three pro:foo")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
|
||||
"3 of 3 tasks"))
|
||||
|
||||
code, out, err = self.t(("add", "four", "pro:foo"))
|
||||
code, out, err = self.t("add four pro:foo")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
|
||||
"4 of 4 tasks"))
|
||||
|
||||
code, out, err = self.t(("1", "done"))
|
||||
code, out, err = self.t("1 done")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "25%",
|
||||
"3 of 4 tasks"))
|
||||
|
||||
code, out, err = self.t(("2", "delete"))
|
||||
code, out, err = self.t("2 delete")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "33%",
|
||||
"2 of 3 tasks"))
|
||||
|
||||
code, out, err = self.t(("3", "modify", "pro:bar"))
|
||||
code, out, err = self.t("3 modify pro:bar")
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo", "50%",
|
||||
"1 of 2 tasks"))
|
||||
self.assertRegexpMatches(err, self.STATUS.format("bar", "0%",
|
||||
|
@ -91,18 +91,18 @@ class TestProjects(TestCase):
|
|||
def test_project_spaces(self):
|
||||
"""projects with spaces are handled correctly"""
|
||||
|
||||
self.t(("add", "hello", "pro:bob"))
|
||||
code, out, err = self.t(("1", "mod", 'pro:"foo bar"'))
|
||||
self.t("add hello pro:bob")
|
||||
code, out, err = self.t('1 mod pro:"foo bar"')
|
||||
self.assertRegexpMatches(err, self.STATUS.format("foo bar", "0%",
|
||||
"1 task"))
|
||||
|
||||
def add_tasks(self):
|
||||
self.t(("add", "testing", "project:existingParent"))
|
||||
self.t(("add", "testing", "project:existingParent.child"))
|
||||
self.t(("add", "testing", "project:abstractParent.kid"))
|
||||
self.t(("add", "testing", "project:.myProject"))
|
||||
self.t(("add", "testing", "project:myProject"))
|
||||
self.t(("add", "testing", "project:.myProject."))
|
||||
self.t("add testing project:existingParent")
|
||||
self.t("add testing project:existingParent.child")
|
||||
self.t("add testing project:abstractParent.kid")
|
||||
self.t("add testing project:.myProject")
|
||||
self.t("add testing project:myProject")
|
||||
self.t("add testing project:.myProject.")
|
||||
|
||||
def validate_indentation(self, out):
|
||||
order = (
|
||||
|
@ -137,7 +137,7 @@ class TestProjects(TestCase):
|
|||
"""
|
||||
self.add_tasks()
|
||||
|
||||
code, out, err = self.t(("projects",))
|
||||
code, out, err = self.t("projects")
|
||||
|
||||
self.validate_indentation(out)
|
||||
|
||||
|
@ -148,7 +148,7 @@ class TestProjects(TestCase):
|
|||
"""
|
||||
self.add_tasks()
|
||||
|
||||
code, out, err = self.t(("summary",))
|
||||
code, out, err = self.t("summary")
|
||||
|
||||
self.validate_indentation(out)
|
||||
|
||||
|
@ -156,19 +156,19 @@ class TestProjects(TestCase):
|
|||
class TestBug299(TestCase):
|
||||
def setUp(self):
|
||||
self.t = Task()
|
||||
self.t(("add", "project:one", "foo"))
|
||||
self.t(("add", "project:ones", "faz"))
|
||||
self.t(("add", "project:phone", "boo"))
|
||||
self.t(("add", "project:bones", "too"))
|
||||
self.t(("add", "project:two", "bar"))
|
||||
self.t(("add", "project:three", "baz"))
|
||||
self.t("add project:one foo")
|
||||
self.t("add project:ones faz")
|
||||
self.t("add project:phone boo")
|
||||
self.t("add project:bones too")
|
||||
self.t("add project:two bar")
|
||||
self.t("add project:three baz")
|
||||
|
||||
def test_project_exclusion_isnt(self):
|
||||
"""check project exclusion using project.isnt:<name>
|
||||
|
||||
Reported in bug 299
|
||||
"""
|
||||
code, out, err = self.t(("list", "project.isnt:one", "pro.isnt:two"))
|
||||
code, out, err = self.t("list project.isnt:one pro.isnt:two")
|
||||
|
||||
self.assertNotRegexpMatches(out, "one.*foo")
|
||||
self.assertRegexpMatches(out, "ones.*faz")
|
||||
|
@ -183,7 +183,7 @@ class TestBug299(TestCase):
|
|||
|
||||
Reported in bug 299
|
||||
"""
|
||||
code, out, err = self.t(("list", "project.hasnt:one", "pro.hasnt:two"))
|
||||
code, out, err = self.t("list project.hasnt:one pro.hasnt:two")
|
||||
|
||||
self.assertNotRegexpMatches(out, "one.*foo")
|
||||
self.assertNotRegexpMatches(out, "ones.*faz")
|
||||
|
@ -203,7 +203,7 @@ class TestBug555(TestCase):
|
|||
|
||||
Reported in bug 555
|
||||
"""
|
||||
code, out, err = self.t(("log", "description", "project:p"))
|
||||
code, out, err = self.t("log description project:p")
|
||||
|
||||
self.assertNotIn("Segmentation fault", out)
|
||||
self.assertNotIn("Segmentation fault", err)
|
||||
|
@ -221,11 +221,11 @@ class TestBug605(TestCase):
|
|||
"""
|
||||
self.t("add One project:p1")
|
||||
|
||||
code, out, err = self.t(("1", "delete"), input="y\n")
|
||||
code, out, err = self.t("1 delete", input="y\n")
|
||||
self.assertIn("is 0% complete", err)
|
||||
|
||||
self.t("add Two project:p1")
|
||||
code, out, err = self.t(("2", "done"))
|
||||
code, out, err = self.t("2 done")
|
||||
self.assertIn("is 100% complete", err)
|
||||
|
||||
class TestBug906(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue