Skip to content

Commit 41c5c23

Browse files
committed
fix: TT-237 Fix test to Update Start time Entries
1 parent c5bbb1f commit 41c5c23

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/time_tracker_api/time_entries/time_entries_namespace_test.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,12 @@ def test_update_time_entry_calls_partial_update_with_incoming_payload(
410410
mocker: MockFixture,
411411
valid_header: dict,
412412
valid_id: str,
413+
owner_id: str,
413414
time_entries_dao,
414415
):
416+
valid_time_entry_input_to_update = valid_time_entry_input.copy()
417+
valid_time_entry_input_to_update["owner_id"] = owner_id
418+
415419
time_entries_dao.repository.partial_update = Mock(return_value={})
416420

417421
time_entries_dao.repository.find = Mock(return_value={})
@@ -420,13 +424,13 @@ def test_update_time_entry_calls_partial_update_with_incoming_payload(
420424
response = client.put(
421425
f'/time-entries/{valid_id}',
422426
headers=valid_header,
423-
json=valid_time_entry_input,
427+
json=valid_time_entry_input_to_update,
424428
follow_redirects=True,
425429
)
426430

427431
assert HTTPStatus.OK == response.status_code
428432
time_entries_dao.repository.partial_update.assert_called_once_with(
429-
valid_id, valid_time_entry_input, ANY
433+
valid_id, valid_time_entry_input_to_update, ANY
430434
)
431435

432436
time_entries_dao.repository.find.assert_called_once()
@@ -464,10 +468,14 @@ def test_update_time_entry_raise_not_found(
464468
mocker: MockFixture,
465469
valid_header: dict,
466470
valid_id: str,
471+
owner_id: str,
467472
time_entries_dao,
468473
):
469474
from werkzeug.exceptions import NotFound
470475

476+
valid_time_entry_input_to_update = valid_time_entry_input.copy()
477+
valid_time_entry_input_to_update["owner_id"] = owner_id
478+
471479
time_entries_dao.repository.partial_update = Mock(side_effect=NotFound)
472480

473481
time_entries_dao.repository.find = Mock(return_value={})
@@ -476,13 +484,13 @@ def test_update_time_entry_raise_not_found(
476484
response = client.put(
477485
f'/time-entries/{valid_id}',
478486
headers=valid_header,
479-
json=valid_time_entry_input,
487+
json=valid_time_entry_input_to_update,
480488
follow_redirects=True,
481489
)
482490

483491
assert HTTPStatus.NOT_FOUND == response.status_code
484492
time_entries_dao.repository.partial_update.assert_called_once_with(
485-
valid_id, valid_time_entry_input, ANY
493+
valid_id, valid_time_entry_input_to_update, ANY
486494
)
487495

488496
time_entries_dao.repository.find.assert_called_once()

0 commit comments

Comments
 (0)