mirror of
https://github.com/GothenburgBitFactory/task-timewarrior-hook.git
synced 2025-06-26 10:54:27 +02:00
prevent tags from being separated inbetween (#34)
Add workaround for the destructured tags from taskpirate This includes a detection of the type of the tags and then converting it back to a list. Unit tests for this behavior are also added.
This commit is contained in:
parent
f76f6ef733
commit
87a3426d81
2 changed files with 66 additions and 1 deletions
|
@ -367,3 +367,62 @@ def test_hook_should_process_stop():
|
|||
)
|
||||
|
||||
verify(subprocess).call(['timew', 'stop', 'Foo', ':yes'])
|
||||
|
||||
@pytest.mark.usefixtures("teardown")
|
||||
def test_hook_should_process_start_issue34_with_multiple_tags():
|
||||
"""on-modify hook should process 'task start' (issue #34) with multiple tags"""
|
||||
|
||||
when(subprocess).call(...)
|
||||
on_modify.main(
|
||||
json.loads(
|
||||
'''{
|
||||
"description": "Foo",
|
||||
"entry": "20190820T203842Z",
|
||||
"modified": "20190820T203842Z",
|
||||
"status": "pending",
|
||||
"tags": ["abc", "xyz"],
|
||||
"uuid": "16af44c5-57d2-43bf-97ed-cf2e541d927f"
|
||||
}'''),
|
||||
json.loads(
|
||||
'''{
|
||||
"description": "Foo",
|
||||
"entry": "20190820T203842Z",
|
||||
"modified": "20190820T203842Z",
|
||||
"start": "20190820T203842Z",
|
||||
"status": "pending",
|
||||
"tags": "abc,xyz",
|
||||
"uuid": "16af44c5-57d2-43bf-97ed-cf2e541d927f"
|
||||
}''')
|
||||
)
|
||||
|
||||
verify(subprocess).call(['timew', 'start', 'Foo', 'abc', 'xyz', ':yes'])
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("teardown")
|
||||
def test_hook_should_process_start_issue34_with_single_tags():
|
||||
"""on-modify hook should process 'task start' (issue #34) with single tags"""
|
||||
|
||||
when(subprocess).call(...)
|
||||
on_modify.main(
|
||||
json.loads(
|
||||
'''{
|
||||
"description": "Foo",
|
||||
"entry": "20190820T203842Z",
|
||||
"modified": "20190820T203842Z",
|
||||
"status": "pending",
|
||||
"tags": ["abc"],
|
||||
"uuid": "16af44c5-57d2-43bf-97ed-cf2e541d927f"
|
||||
}'''),
|
||||
json.loads(
|
||||
'''{
|
||||
"description": "Foo",
|
||||
"entry": "20190820T203842Z",
|
||||
"modified": "20190820T203842Z",
|
||||
"start": "20190820T203842Z",
|
||||
"status": "pending",
|
||||
"tags": "abc",
|
||||
"uuid": "16af44c5-57d2-43bf-97ed-cf2e541d927f"
|
||||
}''')
|
||||
)
|
||||
|
||||
verify(subprocess).call(['timew', 'start', 'Foo', 'abc', ':yes'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue