mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-22 20:23:09 +02:00
Unittest - Update template.t to use Hook.assert* functions
This commit is contained in:
parent
6a3edc88a1
commit
75a2b11638
1 changed files with 8 additions and 4 deletions
|
@ -144,10 +144,12 @@ sys.exit(0)
|
||||||
code, out, err = self.t()
|
code, out, err = self.t()
|
||||||
self.assertIn("This is an example modify hook", out)
|
self.assertIn("This is an example modify hook", out)
|
||||||
|
|
||||||
logs = self.t.hooks[hookname].get_logs()
|
hook = self.t.hooks[hookname]
|
||||||
|
logs = hook.get_logs()
|
||||||
|
|
||||||
# Hook was called once
|
# Hook was called once
|
||||||
self.assertEqual(len(logs["calls"]), 1)
|
hook.assertTriggeredCount(1)
|
||||||
|
hook.assertExitcode(0)
|
||||||
|
|
||||||
# Some message output from the hook
|
# Some message output from the hook
|
||||||
self.assertEqual(logs["output"]["msgs"][0],
|
self.assertEqual(logs["output"]["msgs"][0],
|
||||||
|
@ -168,10 +170,12 @@ sys.exit(0)
|
||||||
code, out, err = self.t()
|
code, out, err = self.t()
|
||||||
self.assertNotIn("This is an example modify hook", out)
|
self.assertNotIn("This is an example modify hook", out)
|
||||||
|
|
||||||
logs = self.t.hooks[hookname].get_logs()
|
hook = self.t.hooks[hookname]
|
||||||
|
logs = hook.get_logs()
|
||||||
|
|
||||||
# Hook was called once
|
# Hook was called once
|
||||||
self.assertEqual(len(logs["calls"]), 1)
|
hook.assertTriggeredCount(1)
|
||||||
|
hook.assertExitcode(1)
|
||||||
|
|
||||||
# Some message output from the hook
|
# Some message output from the hook
|
||||||
self.assertEqual(logs["output"]["msgs"][0],
|
self.assertEqual(logs["output"]["msgs"][0],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue