mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
* Add test case to cover https://github.com/GothenburgBitFactory/taskwarrior/issues/3416 * Add (builtin) on-add-modify test hook and use it * TDB2::add() move hook invocation before save (#3416)
This commit is contained in:
parent
e4c33d1e1d
commit
fb16dbf7cf
3 changed files with 41 additions and 3 deletions
|
@ -58,6 +58,23 @@ class TestHooksOnAdd(TestCase):
|
|||
code, out, err = self.t("1 info")
|
||||
self.assertIn("Description foo", out)
|
||||
|
||||
def test_onadd_builtin_accept_modify(self):
|
||||
"""on-add-accept-modify - a well-behaved, successful, on-add hook, that modifies the added task."""
|
||||
hookname = 'on-add-modify'
|
||||
self.t.hooks.add_default(hookname, log=True)
|
||||
|
||||
code, out, err = self.t("add teh foo")
|
||||
|
||||
hook = self.t.hooks[hookname]
|
||||
hook.assertTriggeredCount(1)
|
||||
hook.assertExitcode(0)
|
||||
|
||||
logs = hook.get_logs()
|
||||
self.assertEqual(logs["output"]["msgs"][0], "FEEDBACK")
|
||||
|
||||
code, out, err = self.t("1 info")
|
||||
self.assertIn("Description the foo", out)
|
||||
|
||||
def test_onadd_builtin_reject(self):
|
||||
"""on-add-reject - a well-behaved, failing, on-add hook."""
|
||||
hookname = 'on-add-reject'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue