mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Test: Updated to use newer form of call
This commit is contained in:
parent
6890fd32c7
commit
b173fd67c2
1 changed files with 30 additions and 28 deletions
58
test/uda.t
58
test/uda.t
|
@ -57,19 +57,19 @@ class TestUdaDate(TestBaseUda):
|
|||
def test_uda_date_task(self):
|
||||
"""Add tasks with and without an UDA date"""
|
||||
|
||||
code, out, err = self.t(("add", "with", "extra:tomorrow"))
|
||||
code, out, err = self.t("add with extra:tomorrow")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("add", "without"))
|
||||
code, out, err = self.t("add without")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+[\d\/]+\s+with")
|
||||
self.assertRegexpMatches(out, "2\s+without")
|
||||
|
||||
def test_uda_bad_date_task(self):
|
||||
"""Add tasks with an invalid UDA date"""
|
||||
code, out, err = self.t.runError(("add", "bad", "extra:bad_date"))
|
||||
code, out, err = self.t.runError("add bad extra:bad_date")
|
||||
self.assertNotIn("Created task", out)
|
||||
self.assertIn("not a valid date", err)
|
||||
|
||||
|
@ -91,28 +91,28 @@ class TestUdaDefault(TestBaseUda):
|
|||
def test_uda_nondefault_task(self):
|
||||
"""Add tasks with non default UDA"""
|
||||
|
||||
code, out, err = self.t(("add", "one", "smell:strong"))
|
||||
code, out, err = self.t("add one smell:strong")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+strong\s+one")
|
||||
|
||||
def test_uda_default_task(self):
|
||||
"""Add tasks with default UDA"""
|
||||
|
||||
code, out, err = self.t(("add", "two"))
|
||||
code, out, err = self.t("add two")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+weak\s+two")
|
||||
|
||||
def test_uda_without_default_task(self):
|
||||
"""Add tasks without default UDA"""
|
||||
|
||||
code, out, err = self.t(("add", "three", "extra:10"))
|
||||
code, out, err = self.t("add three extra:10")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+weak\s+10\s+three")
|
||||
|
||||
|
||||
|
@ -125,23 +125,25 @@ class TestUdaDuration(TestBaseUda):
|
|||
def test_uda_duration_task(self):
|
||||
"""Add tasks with and without an UDA duration"""
|
||||
|
||||
code, out, err = self.t(("add", "with", "extra:1day"))
|
||||
code, out, err = self.t("add with extra:1day")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("add", "without"))
|
||||
code, out, err = self.t("add without")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.tap(out)
|
||||
self.assertRegexpMatches(out, "1\s+P1D\s+with")
|
||||
self.assertRegexpMatches(out, "2\s+without")
|
||||
|
||||
# Ensure 'extra' is stored in original form.
|
||||
code, out, err = self.t(("1", "export"))
|
||||
code, out, err = self.t("1 export")
|
||||
self.tap(out)
|
||||
self.assertRaisesRegexp(out, '"extra":"1day"')
|
||||
|
||||
def test_uda_bad_duration_task(self):
|
||||
"""Add tasks with an invalid UDA duration"""
|
||||
code, out, err = self.t.runError(("add", "bad", "extra:bad_duration"))
|
||||
code, out, err = self.t.runError("add bad extra:bad_duration")
|
||||
self.assertNotIn("Created task", out)
|
||||
self.assertIn("The duration value 'bad_duration' is not supported",
|
||||
err)
|
||||
|
@ -156,19 +158,19 @@ class TestUdaNumeric(TestBaseUda):
|
|||
def test_uda_numeric_task(self):
|
||||
"""Add tasks with and without an UDA numeric"""
|
||||
|
||||
code, out, err = self.t(("add", "with", "extra:123"))
|
||||
code, out, err = self.t("add with extra:123")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("add", "without"))
|
||||
code, out, err = self.t("add without")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+\d+\s+with")
|
||||
self.assertRegexpMatches(out, "2\s+without")
|
||||
|
||||
def test_uda_bad_numeric_task(self):
|
||||
"""Add tasks with an invalid UDA numeric"""
|
||||
code, out, err = self.t.runError(("add", "bad", "extra:bad_numeric"))
|
||||
code, out, err = self.t.runError("add bad extra:bad_numeric")
|
||||
self.assertNotIn("Created task", out)
|
||||
self.assertIn("The value 'bad_numeric' is not a valid numeric value",
|
||||
err)
|
||||
|
@ -183,12 +185,12 @@ class TestUdaString(TestBaseUda):
|
|||
def test_uda_string_task(self):
|
||||
"""Add tasks with and without an UDA string"""
|
||||
|
||||
code, out, err = self.t(("add", "with", "extra:'one two'"))
|
||||
code, out, err = self.t("add with extra:'one two'")
|
||||
self.assertIn("Created task", out)
|
||||
code, out, err = self.t(("add", "without"))
|
||||
code, out, err = self.t("add without")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+one two\s+with")
|
||||
self.assertRegexpMatches(out, "2\s+without")
|
||||
|
||||
|
@ -203,26 +205,26 @@ class TestUdaValue(TestBaseUda):
|
|||
def test_uda_value_task(self):
|
||||
"""Add tasks with valid UDA values"""
|
||||
|
||||
code, out, err = self.t(("add", "one", "extra:weak"))
|
||||
code, out, err = self.t("add one extra:weak")
|
||||
self.assertIn("Created task", out)
|
||||
code, out, err = self.t(("add", "two", "extra:strong"))
|
||||
code, out, err = self.t("add two extra:strong")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+weak\s+one")
|
||||
self.assertRegexpMatches(out, "2\s+strong\s+two")
|
||||
|
||||
def test_uda_invalid_value_task(self):
|
||||
"""Add tasks with invalid UDA value"""
|
||||
|
||||
code, out, err = self.t(("add", "one", "extra:strong"))
|
||||
code, out, err = self.t("add one extra:strong")
|
||||
self.assertIn("Created task", out)
|
||||
|
||||
code, out, err = self.t.runError(("add", "two", "extra:toxic"))
|
||||
code, out, err = self.t.runError("add two extra:toxic")
|
||||
self.assertIn("The 'extra' attribute does not allow a value of "
|
||||
"'toxic'", err)
|
||||
|
||||
code, out, err = self.t(("uda",))
|
||||
code, out, err = self.t("uda")
|
||||
self.assertRegexpMatches(out, "1\s+strong\s+one")
|
||||
self.assertNotRegexpMatches(out, "1\s+toxic\s+two")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue