mirror of
https://github.com/GothenburgBitFactory/task-timewarrior-hook.git
synced 2025-06-26 10:54:27 +02:00
Overhaul test
- Update example JSONs - Test only for active time tracking - Test resulting intervals, not resulting output Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
f375654523
commit
2504493de6
1 changed files with 82 additions and 99 deletions
|
@ -53,185 +53,168 @@ class TestOnModifyHookScript(TestCase):
|
||||||
|
|
||||||
def test_hook_should_process_annotate(self):
|
def test_hook_should_process_annotate(self):
|
||||||
"""on-modify hook should process 'task annotate'"""
|
"""on-modify hook should process 'task annotate'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "Foo", "entry": "20180316T231055Z", "modified": "20180316T231055Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3" }
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"3495a755-c4c6-4106-aabe-c0d3d128b65a"}
|
||||||
{ "description": "Foo", "entry": "20180316T231055Z", "modified": "20180316T231055Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3", "annotations": [{ "entry": "20180316T231239Z", "description": "Bar" }]}
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"3495a755-c4c6-4106-aabe-c0d3d128b65a","annotations":[{"entry":"20190820T201911Z","description":"Annotation"}]}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3", "modified": "20180316T231055Z", "entry": "20180316T231055Z", "annotations": [{"entry": "20180316T231239Z", "description": "Bar"}], "description": "Foo"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Foo"], expectedAnnotation="Annotation")
|
||||||
|
|
||||||
def test_hook_should_process_append(self):
|
def test_hook_should_process_append(self):
|
||||||
"""on-modify hook should process 'task append'"""
|
"""on-modify hook should process 'task append'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "FooBar", "entry": "20180316T231125Z", "modified": "20180316T231808Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"da603270-ce2b-4a5a-9273-c67c2d2d0067"}
|
||||||
{ "description": "FooBar Baz", "entry": "20180316T231125Z", "modified": "20180316T231808Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo Bar","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"da603270-ce2b-4a5a-9273-c67c2d2d0067"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "entry": "20180316T231125Z", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094", "description": "FooBar Baz", "modified": "20180316T231808Z"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Foo Bar"])
|
||||||
|
|
||||||
def test_hook_should_process_delete(self):
|
def test_hook_should_process_delete(self):
|
||||||
"""on-modify hook should process 'task delete'"""
|
"""on-modify hook should process 'task delete'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "Read Taskwarrior documents later", "entry": "20180316T225357Z", "modified": "20180316T225357Z", "status": "pending", "uuid": "3bfe7518-8644-4c3c-9788-940d782fefac" }
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"25b66283-96e0-42b4-b835-8efd0ea1043c"}
|
||||||
{ "description": "Read Taskwarrior documents later", "end": "20180316T230837Z", "entry": "20180316T225357Z", "modified": "20180316T225357Z", "status": "deleted", "uuid": "3bfe7518-8644-4c3c-9788-940d782fefac" }
|
{"description":"Foo","end":"20190820T201911Z","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"deleted","uuid":"25b66283-96e0-42b4-b835-8efd0ea1043c"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "deleted", "end": "20180316T230837Z", "uuid": "3bfe7518-8644-4c3c-9788-940d782fefac", "modified": "20180316T225357Z", "entry": "20180316T225357Z", "description": "Read Taskwarrior documents later"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertClosedInterval(j[0], expectedTags=["Foo"])
|
||||||
|
|
||||||
def test_hook_should_process_denotate(self):
|
def test_hook_should_process_denotate(self):
|
||||||
"""on-modify hook should process 'task denotate'"""
|
"""on-modify hook should process 'task denotate'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
self.t("annotate @1 Annotation")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "Foo", "entry": "20180316T231055Z", "modified": "20180316T231239Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3", "annotations": [{ "entry": "20180316T231239Z", "description": "Bar" }]}
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"8811cc93-a495-4fa6-993e-2b96cffc48e0","annotations":[{"entry":"20190820T201911Z","description":"Annotation"}]}
|
||||||
{ "description": "Foo", "entry": "20180316T231055Z", "modified": "20180316T231239Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3" }
|
{"description":"Foo","entry":"20190820T201911Z","modified":"20190820T201911Z","start":"20190820T201911Z","status":"pending","uuid":"8811cc93-a495-4fa6-993e-2b96cffc48e0"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "entry": "20180316T231055Z", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3", "description": "Foo", "modified": "20180316T231239Z"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Foo"], expectedAnnotation="")
|
||||||
|
|
||||||
def test_hook_should_process_done(self):
|
def test_hook_should_process_done(self):
|
||||||
"""on-modify hook should process 'task done'"""
|
"""on-modify hook should process 'task done'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "Pay bills", "entry": "20180316T225418Z", "modified": "20180316T225418Z", "priority": "H", "status": "pending", "uuid": "94699c4e-b1ae-4838-bc6b-c8476251f898" }
|
{"description":"Foo","entry":"20190820T201912Z","modified":"20190820T201912Z","start":"20190820T201912Z","status":"pending","uuid":"c418b958-5c3c-4633-89a4-4a2f678d74d0"}
|
||||||
{ "description": "Pay bills", "end": "20180316T230221Z", "entry": "20180316T225418Z", "modified": "20180316T225418Z", "priority": "H", "status": "completed", "uuid": "94699c4e-b1ae-4838-bc6b-c8476251f898" }
|
{"description":"Foo","end":"20190820T201912Z","entry":"20190820T201912Z","modified":"20190820T201912Z","status":"completed","uuid":"c418b958-5c3c-4633-89a4-4a2f678d74d0"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "completed", "end": "20180316T230221Z", "description": "Pay bills", "modified": "20180316T225418Z", "priority": "H", "entry": "20180316T225418Z", "uuid": "94699c4e-b1ae-4838-bc6b-c8476251f898"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
def test_hook_should_process_edit(self):
|
j = self.t.export()
|
||||||
"""on-modify hook should process 'task edit'"""
|
self.assertEqual(len(j), 1)
|
||||||
out, err = self.process.communicate(input="""\
|
self.assertClosedInterval(j[0], expectedTags=["Foo"])
|
||||||
{ "description": "Foo", "entry": "20180316T231125Z", "modified": "20180316T231055Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
|
||||||
{ "description": "FooBar", "entry": "20180316T231125Z", "modified": "20180316T231055Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
|
||||||
""")
|
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "entry": "20180316T231125Z", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094", "description": "FooBar", "modified": "20180316T231055Z"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
|
||||||
|
|
||||||
def test_hook_should_process_modify_desc(self):
|
def test_hook_should_process_modify_desc(self):
|
||||||
"""on-modify hook should process 'task modify' for changing description"""
|
"""on-modify hook should process 'task modify' for changing description"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
self.t("start dummy")
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534"}
|
{"description":"Foo","entry":"20190820T203416Z","modified":"20190820T203416Z","start":"20190820T203416Z","status":"pending","uuid":"189e6745-04e0-4b17-949f-900cf63ab8d9"}
|
||||||
{"description":"foo","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534"}
|
{"description":"Bar","entry":"20190820T203416Z","modified":"20190820T203416Z","start":"20190820T203416Z","status":"pending","uuid":"189e6745-04e0-4b17-949f-900cf63ab8d9"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertRegexpMatches(out, """\
|
|
||||||
Removed dummy from @1
|
|
||||||
Note: 'foo' is a new tag.
|
|
||||||
Added foo to @1
|
|
||||||
\{"status": "pending", "uuid": "3422d76c-c087-4ecd-9c62-1246b078e534", "modified": "20180317T092629Z", "start": "20180317T092629Z", "entry": "20180317T092629Z", "description": "foo"\}
|
|
||||||
""")
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Bar"])
|
||||||
|
|
||||||
def test_hook_should_process_modify_tags(self):
|
def test_hook_should_process_modify_tags(self):
|
||||||
"""on-modify hook should process 'task modify' for changing tags"""
|
"""on-modify hook should process 'task modify' for changing tags"""
|
||||||
|
self.t("start 10min ago Foo Tag Bar")
|
||||||
|
|
||||||
self.t("start dummy tag1 tag2")
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","tags":["tag1","tag2"]}
|
{"description":"Foo","entry":"20190820T203620Z","modified":"20190820T203620Z","start":"20190820T203620Z","status":"pending","tags":["Tag","Bar"],"uuid":"6cab88f0-ac12-4a87-995a-0e7d39810c05"}
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","tags":["tag3","tag4"]}
|
{"description":"Foo","entry":"20190820T203620Z","modified":"20190820T203620Z","start":"20190820T203620Z","status":"pending","tags":["Tag","Baz"],"uuid":"6cab88f0-ac12-4a87-995a-0e7d39810c05"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertRegexpMatches(out, """\
|
|
||||||
Removed dummy tag1 tag2 from @1
|
|
||||||
Note: 'dummy' is a new tag.
|
|
||||||
Note: 'tag3' is a new tag.
|
|
||||||
Note: 'tag4' is a new tag.
|
|
||||||
Added dummy tag3 tag4 to @1
|
|
||||||
\{"status": "pending", "uuid": "3422d76c-c087-4ecd-9c62-1246b078e534", "tags": \["tag3", "tag4"\], "modified": "20180317T092629Z", "start": "20180317T092629Z", "entry": "20180317T092629Z", "description": "dummy"\}
|
|
||||||
""")
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Foo", "Tag", "Baz"])
|
||||||
|
|
||||||
def test_hook_should_process_modify_project(self):
|
def test_hook_should_process_modify_project(self):
|
||||||
"""on-modify hook should process 'task modify' for changing project"""
|
"""on-modify hook should process 'task modify' for changing project"""
|
||||||
|
self.t("start Foo dummy")
|
||||||
|
|
||||||
self.t("start dummy proj1")
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","project":"proj1"}
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","project":"dummy","start":"20190820T203842Z","status":"pending","uuid":"d95dc7a0-6189-4692-b58a-4ab60d539c8d"}
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","start":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","project":"proj2"}
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","project":"test","start":"20190820T203842Z","status":"pending","uuid":"d95dc7a0-6189-4692-b58a-4ab60d539c8d"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertRegexpMatches(out, """\
|
|
||||||
Removed dummy proj1 from @1
|
|
||||||
Note: 'dummy' is a new tag.
|
|
||||||
Note: 'proj2' is a new tag.
|
|
||||||
Added dummy proj2 to @1
|
|
||||||
\{"status": "pending", "uuid": "3422d76c-c087-4ecd-9c62-1246b078e534", "modified": "20180317T092629Z", "project": "proj2", "start": "20180317T092629Z", "entry": "20180317T092629Z", "description": "dummy"\}
|
|
||||||
""")
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
def test_hook_should_process_modify_not_tracked(self):
|
j = self.t.export()
|
||||||
"""on-modify hook should process 'task modify' for tasks which are not time-tracked"""
|
self.assertEqual(len(j), 1)
|
||||||
out, err = self.process.communicate(input="""\
|
self.assertOpenInterval(j[0], expectedTags=["Foo", "test"])
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","project":"proj1"}
|
|
||||||
{"description":"dummy","entry":"20180317T092629Z","modified":"20180317T092629Z","status":"pending","uuid":"3422d76c-c087-4ecd-9c62-1246b078e534","project":"proj2"}
|
|
||||||
""")
|
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "uuid": "3422d76c-c087-4ecd-9c62-1246b078e534", "modified": "20180317T092629Z", "project": "proj2", "entry": "20180317T092629Z", "description": "dummy"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
|
||||||
|
|
||||||
# This is needed to test the case for task which are time-tracked and modify is called for changes other than project/tag/description
|
|
||||||
def test_hook_should_process_modify_due_date(self):
|
|
||||||
"""on-modify hook should process 'task modify' for time-tracked task for changing annotations"""
|
|
||||||
|
|
||||||
self.t("start dummy")
|
|
||||||
out, err = self.process.communicate(input="""\
|
|
||||||
{"status": "pending", "description": "dummy", "modified": "20180513T073915Z", "due": "20180514T000000Z", "start": "20180513T073915Z", "entry": "20180513T054634Z", "uuid": "09e9620e-8906-47ad-92c5-305894534aac"}
|
|
||||||
{"status": "pending", "description": "dummy", "modified": "20180513T073915Z", "due": "20180512T000000Z", "start": "20180513T073915Z", "entry": "20180513T054634Z", "uuid": "09e9620e-8906-47ad-92c5-305894534aac"}
|
|
||||||
""")
|
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "description": "dummy", "due": "20180512T000000Z", "modified": "20180513T073915Z", "start": "20180513T073915Z", "entry": "20180513T054634Z", "uuid": "09e9620e-8906-47ad-92c5-305894534aac"}\n', out)
|
|
||||||
|
|
||||||
self.assertEqual('', err)
|
|
||||||
|
|
||||||
def test_hook_should_process_prepend(self):
|
def test_hook_should_process_prepend(self):
|
||||||
"""on-modify hook should process 'task prepend'"""
|
"""on-modify hook should process 'task prepend'"""
|
||||||
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "Foo", "entry": "20180316T231055Z", "modified": "20180316T231617Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3" }
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","start":"20190820T203842Z","status":"pending","uuid":"02bc8839-b304-49f9-ac1a-29ac4850583f"}
|
||||||
{ "description": "Hey Foo", "entry": "20180316T231055Z", "modified": "20180316T231617Z", "status": "pending", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3" }
|
{"description":"Prefix Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","start":"20190820T203842Z","status":"pending","uuid":"02bc8839-b304-49f9-ac1a-29ac4850583f"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertEqual('{"status": "pending", "entry": "20180316T231055Z", "uuid": "d07b40c4-5df7-409f-bf98-930e550333b3", "description": "Hey Foo", "modified": "20180316T231617Z"}\n', out)
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Prefix Foo"])
|
||||||
|
|
||||||
def test_hook_should_process_start(self):
|
def test_hook_should_process_start(self):
|
||||||
"""on-modify hook should process 'task start'"""
|
"""on-modify hook should process 'task start'"""
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "FooBar", "due": "20180331T220000Z", "entry": "20180316T231125Z", "modified": "20180316T232513Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","status":"pending","uuid":"16af44c5-57d2-43bf-97ed-cf2e541d927f"}
|
||||||
{ "description": "FooBar", "due": "20180331T220000Z", "entry": "20180316T231125Z", "modified": "20180316T232513Z", "start": "20180316T232651Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","start":"20190820T203842Z","status":"pending","uuid":"16af44c5-57d2-43bf-97ed-cf2e541d927f"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertRegexpMatches(out, """\
|
|
||||||
Tracking FooBar
|
|
||||||
Started \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}
|
|
||||||
Current (\d{2}:| )\d{2}
|
|
||||||
Total ?\d{1,2}:\d{2}:\d{2}
|
|
||||||
\{"status": "pending", "description": "FooBar", "modified": "20180316T232513Z", "due": "20180331T220000Z", "start": "20180316T232651Z", "entry": "20180316T231125Z", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094"\}
|
|
||||||
""")
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertOpenInterval(j[0], expectedTags=["Foo"])
|
||||||
|
|
||||||
def test_hook_should_process_stop(self):
|
def test_hook_should_process_stop(self):
|
||||||
"""on-modify hook should process 'task stop'"""
|
"""on-modify hook should process 'task stop'"""
|
||||||
self.t("start 10min ago")
|
self.t("start 10min ago Foo")
|
||||||
|
|
||||||
out, err = self.process.communicate(input="""\
|
out, err = self.process.communicate(input="""\
|
||||||
{ "description": "FooBar", "due": "20180331T220000Z", "entry": "20180316T231125Z", "modified": "20180316T232651Z", "start": "20180316T232651Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","start":"20190820T203842Z","status":"pending","uuid":"13f83e99-f6a2-4857-9e00-bdeede064772"}
|
||||||
{ "description": "FooBar", "due": "20180331T220000Z", "entry": "20180316T231125Z", "modified": "20180316T232651Z", "status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094" }
|
{"description":"Foo","entry":"20190820T203842Z","modified":"20190820T203842Z","status":"pending","uuid":"13f83e99-f6a2-4857-9e00-bdeede064772"}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.assertRegexpMatches(out, """\
|
|
||||||
Recorded
|
|
||||||
Started \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}
|
|
||||||
Ended (\d{2}:| )\d{2}
|
|
||||||
Total ?\d{1,2}:\d{2}:\d{2}
|
|
||||||
\{"status": "pending", "uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094", "modified": "20180316T232651Z", "due": "20180331T220000Z", "entry": "20180316T231125Z", "description": "FooBar"\}
|
|
||||||
""")
|
|
||||||
self.assertEqual('', err)
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertEqual(len(j), 1)
|
||||||
|
self.assertClosedInterval(j[0], expectedTags=["Foo"])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from simpletap import TAPTestRunner
|
from simpletap import TAPTestRunner
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue