Skip to content

Commit

Permalink
Stash entries (Switch to mockito)
Browse files Browse the repository at this point in the history
  • Loading branch information
lauft committed Mar 8, 2025
1 parent d2a8950 commit 3aa156a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/test_on-modify_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,38 @@ def test_hook_should_process_start_issue34_with_single_tags():
)

verify(subprocess).call(['timew', 'start', 'Foo', 'abc', ':yes'])


def test_hook_should_process_add(mocker):
mocker.patch('subprocess.call')
on_modify.main(
json.loads('{}'),
json.loads(
'''{
"description":"Foo",
"entry":"20191105T162938Z",
"modified":"20191105T162938Z",
"status":"pending",
"uuid":"125ead59-4011-46b9-b7c4-09595be2903d"
}''')
)

subprocess.call.assert_not_called()


def test_hook_should_process_add_start(mocker):
mocker.patch('subprocess.call')
on_modify.main(
json.loads('{}'),
json.loads(
'''{
"description":"Foo",
"entry":"20191105T162938Z",
"modified":"20191105T162938Z",
"start":"20191105T162938Z",
"status":"pending",
"uuid":"c27e9913-ad8c-4830-ba58-7dde9c285ff6"
}''')
)

subprocess.call.assert_called_once_with(['timew', 'start', '20191105T162938Z', 'Foo', ':yes'])

0 comments on commit 3aa156a

Please sign in to comment.