From c68d7996ebffccd87a989507632b22e9c677ab2d Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sat, 8 Mar 2025 09:22:31 +0100 Subject: [PATCH] Stash entries (Switch to mockito) --- test/test_on-modify_unit.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/test_on-modify_unit.py b/test/test_on-modify_unit.py index ed67161..04c2cc9 100755 --- a/test/test_on-modify_unit.py +++ b/test/test_on-modify_unit.py @@ -427,3 +427,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'])