mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 23:46:42 +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
60
test/dom.t
60
test/dom.t
|
@ -40,144 +40,144 @@ class TestDOM(TestCase):
|
|||
def setUpClass(cls):
|
||||
cls.t = Task()
|
||||
cls.t.config("dateformat", "YMD")
|
||||
cls.t(("add", "one", "due:20110901"))
|
||||
cls.t(("add", "two", "due:1.due"))
|
||||
cls.t(("add", "three", "due:20110901", "wait:due", "+tag1", "+tag2"))
|
||||
cls.t(("3", "annotate", "note"))
|
||||
cls.t("add one due:20110901")
|
||||
cls.t("add two due:1.due")
|
||||
cls.t("add three due:20110901 wait:due +tag1 +tag2")
|
||||
cls.t("3 annotate note")
|
||||
|
||||
def test_dom_task_ref(self):
|
||||
""" DOM reference to other task """
|
||||
code, out, err = self.t(("_get", "2.due"))
|
||||
code, out, err = self.t("_get 2.due")
|
||||
self.assertIn("2011-09-01T00:00:00", out)
|
||||
|
||||
def test_dom_cli_ref(self):
|
||||
""" DOM reference to current command line """
|
||||
code, out, err = self.t(("_get", "3.wait"))
|
||||
code, out, err = self.t("_get 3.wait")
|
||||
self.assertIn("2011-09-01T00:00:00", out)
|
||||
|
||||
def test_dom_id_uuid_roundtrip(self):
|
||||
""" DOM id/uuid roundtrip """
|
||||
code, out, err = self.t(("_get", "1.uuid"))
|
||||
code, out, err = self.t("_get 1.uuid")
|
||||
uuid = out.strip()
|
||||
code, out, err = self.t(("_get", uuid + ".id"))
|
||||
code, out, err = self.t("_get {0}.id".format(uuid))
|
||||
self.assertEqual("1\n", out)
|
||||
|
||||
def test_dom_fail(self):
|
||||
""" DOM lookup of missing item """
|
||||
code, out, err = self.t(("_get", "4.description"))
|
||||
code, out, err = self.t("_get 4.description")
|
||||
self.assertEqual("\n", out)
|
||||
|
||||
def test_dom_tags(self):
|
||||
""" DOM 3.tags """
|
||||
code, out, err = self.t(("_get", "3.tags"))
|
||||
code, out, err = self.t("_get 3.tags")
|
||||
self.assertEqual("tag1,tag2\n", out)
|
||||
|
||||
def test_dom_tags_tag1(self):
|
||||
""" DOM 3.tags.tag1 """
|
||||
code, out, err = self.t(("_get", "3.tags.tag1"))
|
||||
code, out, err = self.t("_get 3.tags.tag1")
|
||||
self.assertEqual("tag1\n", out)
|
||||
|
||||
def test_dom_tags_OVERDUE(self):
|
||||
""" DOM 3.tags.OVERDUE """
|
||||
code, out, err = self.t(("_get", "3.tags.OVERDUE"))
|
||||
code, out, err = self.t("_get 3.tags.OVERDUE")
|
||||
self.assertEqual("OVERDUE\n", out)
|
||||
|
||||
def test_dom_due_year(self):
|
||||
""" DOM 3.due.year """
|
||||
code, out, err = self.t(("_get", "3.due.year"))
|
||||
code, out, err = self.t("_get 3.due.year")
|
||||
self.assertEqual("2011\n", out)
|
||||
|
||||
def test_dom_due_month(self):
|
||||
""" DOM 3.due.month """
|
||||
code, out, err = self.t(("_get", "3.due.month"))
|
||||
code, out, err = self.t("_get 3.due.month")
|
||||
self.assertEqual("9\n", out)
|
||||
|
||||
def test_dom_due_day(self):
|
||||
""" DOM 3.due.day """
|
||||
code, out, err = self.t(("_get", "3.due.day"))
|
||||
code, out, err = self.t("_get 3.due.day")
|
||||
self.assertEqual("1\n", out)
|
||||
|
||||
def test_dom_due_week(self):
|
||||
""" DOM 3.due.week """
|
||||
code, out, err = self.t(("_get", "3.due.week"))
|
||||
code, out, err = self.t("_get 3.due.week")
|
||||
self.assertEqual("36\n", out)
|
||||
|
||||
def test_dom_due_weekday(self):
|
||||
""" DOM 3.due.weekday """
|
||||
code, out, err = self.t(("_get", "3.due.weekday"))
|
||||
code, out, err = self.t("_get 3.due.weekday")
|
||||
self.assertEqual("4\n", out)
|
||||
|
||||
def test_dom_due_hour(self):
|
||||
""" DOM 3.due.hour """
|
||||
code, out, err = self.t(("_get", "3.due.hour"))
|
||||
code, out, err = self.t("_get 3.due.hour")
|
||||
self.assertEqual("0\n", out)
|
||||
|
||||
def test_dom_due_minute(self):
|
||||
""" DOM 3.due.minute """
|
||||
code, out, err = self.t(("_get", "3.due.minute"))
|
||||
code, out, err = self.t("_get 3.due.minute")
|
||||
self.assertEqual("0\n", out)
|
||||
|
||||
def test_dom_due_second(self):
|
||||
""" DOM 3.due.second """
|
||||
code, out, err = self.t(("_get", "3.due.second"))
|
||||
code, out, err = self.t("_get 3.due.second")
|
||||
self.assertEqual("0\n", out)
|
||||
|
||||
def test_dom_annotation_entry(self):
|
||||
""" DOM 3.annotations.1.entry """
|
||||
code, out, err = self.t(("_get", "3.annotations.1.entry"))
|
||||
code, out, err = self.t("_get 3.annotations.1.entry")
|
||||
self.assertRegexpMatches(out, r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}")
|
||||
|
||||
def test_dom_annotation_description(self):
|
||||
""" DOM 3.annotations.1.description """
|
||||
code, out, err = self.t(("_get", "3.annotations.1.description"))
|
||||
code, out, err = self.t("_get 3.annotations.1.description")
|
||||
self.assertIn("note\n", out)
|
||||
|
||||
def test_dom_system_version(self):
|
||||
""" DOM system.version """
|
||||
code, out, err = self.t(("_get", "system.version"))
|
||||
code, out, err = self.t("_get system.version")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertRegexpMatches(out, r"\d\.\d+\.\d+")
|
||||
|
||||
def test_dom_system_os(self):
|
||||
""" DOM system.os """
|
||||
code, out, err = self.t(("_get", "system.os"))
|
||||
code, out, err = self.t("_get system.os")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertEqual(len(out) > 4, True)
|
||||
self.assertNotIn("<unknown>", out)
|
||||
|
||||
def test_dom_context_program(self):
|
||||
""" DOM context.program """
|
||||
code, out, err = self.t(("_get", "context.program"))
|
||||
code, out, err = self.t("_get context.program")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertIn("task", out)
|
||||
|
||||
def test_dom_context_args(self):
|
||||
""" DOM context.args """
|
||||
code, out, err = self.t(("_get", "context.args"))
|
||||
code, out, err = self.t("_get context.args")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertIn("task _get context.args", out)
|
||||
|
||||
def test_dom_context_width(self):
|
||||
""" DOM context.width """
|
||||
code, out, err = self.t(("_get", "context.width"))
|
||||
code, out, err = self.t("_get context.width")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertRegexpMatches(out, r"\d+")
|
||||
|
||||
def test_dom_context_height(self):
|
||||
""" DOM context.height """
|
||||
code, out, err = self.t(("_get", "context.height"))
|
||||
code, out, err = self.t("_get context.height")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertRegexpMatches(out, r"\d+")
|
||||
|
||||
def test_dom_rc_name(self):
|
||||
""" DOM rc.dateformat """
|
||||
code, out, err = self.t(("_get", "rc.dateformat"))
|
||||
code, out, err = self.t("_get rc.dateformat")
|
||||
self.assertEqual(code, 0)
|
||||
self.assertIn("YMD", out)
|
||||
|
||||
def test_dom_rc_missing(self):
|
||||
""" DOM rc.missing """
|
||||
code, out, err = self.t.runError(("_get", "rc.missing"))
|
||||
code, out, err = self.t.runError("_get rc.missing")
|
||||
self.assertEqual(code, 1)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue