Skip to content

Commit bc12d5d

Browse files
committed
test(time-entries): ✅ update tests to meet changes in DAO
1 parent aae2fac commit bc12d5d

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

tests/time_tracker_api/time_entries/time_entries_namespace_test.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def test_list_all_time_entries(
146146
time_entries_dao,
147147
)
148148

149-
repository_find_all_mock = mocker.patch.object(
150-
time_entries_dao.repository, 'find_all', return_value=[]
149+
dao_get_all_mock = mocker.patch.object(
150+
time_entries_dao, 'get_all', return_value=[]
151151
)
152152

153153
response = client.get(
@@ -156,7 +156,7 @@ def test_list_all_time_entries(
156156

157157
assert HTTPStatus.OK == response.status_code
158158
assert [] == json.loads(response.data)
159-
repository_find_all_mock.assert_called_once()
159+
dao_get_all_mock.assert_called_once()
160160

161161

162162
def test_get_time_entry_should_succeed_with_valid_id(
@@ -166,8 +166,8 @@ def test_get_time_entry_should_succeed_with_valid_id(
166166
time_entries_dao,
167167
)
168168

169-
repository_find_mock = mocker.patch.object(
170-
time_entries_dao.repository, 'find', return_value=fake_time_entry
169+
dao_get_mock = mocker.patch.object(
170+
time_entries_dao, 'get', return_value={}
171171
)
172172

173173
valid_id = fake.random_int(1, 9999)
@@ -179,9 +179,7 @@ def test_get_time_entry_should_succeed_with_valid_id(
179179

180180
assert HTTPStatus.OK == response.status_code
181181
fake_time_entry == json.loads(response.data)
182-
repository_find_mock.assert_called_once_with(
183-
str(valid_id), ANY, peeker=ANY
184-
)
182+
dao_get_mock.assert_called_once_with(str(valid_id))
185183

186184

187185
def test_get_time_entry_should_response_with_unprocessable_entity_for_invalid_id_format(
@@ -614,20 +612,15 @@ def test_find_all_is_called_with_generated_dates(
614612
time_entries_dao,
615613
)
616614

617-
repository_find_all_mock = mocker.patch.object(
618-
time_entries_dao.repository, 'find_all', return_value=[]
615+
dao_get_all_mock = mocker.patch.object(
616+
time_entries_dao, 'get_all', return_value=[]
619617
)
620618

621619
response = client.get(url, headers=valid_header, follow_redirects=True)
622620

623-
date_range = get_date_range_of_month(year, month)
624-
conditions = {'owner_id': owner_id}
625-
626621
assert HTTPStatus.OK == response.status_code
627622
assert json.loads(response.data) is not None
628-
repository_find_all_mock.assert_called_once_with(
629-
ANY, conditions=conditions, date_range=date_range
630-
)
623+
dao_get_all_mock.assert_called_once()
631624

632625

633626
def test_summary_is_called_with_date_range_from_worked_time_module(

0 commit comments

Comments
 (0)