55import pytest
66
77from tests .data .test_defaults import DEFAULT_API_URL , PaginatedResults
8- from tests .utils .test_utils import (
9- auth_matcher ,
10- data_matcher ,
11- enumerate_async ,
12- mock_route ,
13- request_id_matcher ,
14- )
8+ from tests .utils .test_utils import api_headers , enumerate_async , mock_route
159
1610if TYPE_CHECKING :
1711 import respx
@@ -38,7 +32,7 @@ async def test_get_project(
3832 url = endpoint ,
3933 json = default_project_response ,
4034 status = 200 ,
41- matchers = [ auth_matcher ()] ,
35+ headers = api_headers () ,
4236 )
4337
4438 project = todoist_api .get_project (project_id )
@@ -71,10 +65,7 @@ async def test_get_projects(
7165 json = page ,
7266 status = 200 ,
7367 params = {"cursor" : cursor } if cursor else {},
74- matchers = [
75- auth_matcher (),
76- request_id_matcher (),
77- ],
68+ headers = api_headers (),
7869 )
7970 cursor = page ["next_cursor" ]
8071
@@ -115,10 +106,7 @@ async def test_search_projects(
115106 json = page ,
116107 status = 200 ,
117108 params = {"query" : query } | ({"cursor" : cursor } if cursor else {}),
118- matchers = [
119- auth_matcher (),
120- request_id_matcher (),
121- ],
109+ headers = api_headers (),
122110 )
123111 cursor = page ["next_cursor" ]
124112
@@ -155,11 +143,8 @@ async def test_add_project_minimal(
155143 url = f"{ DEFAULT_API_URL } /projects" ,
156144 json = default_project_response ,
157145 status = 200 ,
158- matchers = [
159- auth_matcher (),
160- request_id_matcher (),
161- data_matcher ({"name" : project_name }),
162- ],
146+ headers = api_headers (),
147+ request_json = {"name" : project_name },
163148 )
164149
165150 new_project = todoist_api .add_project (name = project_name )
@@ -196,11 +181,8 @@ async def test_add_project_full(
196181 url = f"{ DEFAULT_API_URL } /projects" ,
197182 json = default_project_response ,
198183 status = 200 ,
199- matchers = [
200- auth_matcher (),
201- request_id_matcher (),
202- data_matcher ({"name" : project_name } | args ),
203- ],
184+ headers = api_headers (),
185+ request_json = {"name" : project_name } | args ,
204186 )
205187
206188 new_project = todoist_api .add_project (name = project_name , ** args )
@@ -234,7 +216,8 @@ async def test_update_project(
234216 url = f"{ DEFAULT_API_URL } /projects/{ default_project .id } " ,
235217 json = updated_project_dict ,
236218 status = 200 ,
237- matchers = [auth_matcher (), request_id_matcher (), data_matcher (args )],
219+ headers = api_headers (),
220+ request_json = args ,
238221 )
239222
240223 response = todoist_api .update_project (project_id = default_project .id , ** args )
@@ -269,7 +252,7 @@ async def test_archive_project(
269252 url = endpoint ,
270253 json = archived_project_dict ,
271254 status = 200 ,
272- matchers = [ auth_matcher (), request_id_matcher ()] ,
255+ headers = api_headers () ,
273256 )
274257
275258 project = todoist_api .archive_project (project_id )
@@ -302,7 +285,7 @@ async def test_unarchive_project(
302285 url = endpoint ,
303286 json = unarchived_project_dict ,
304287 status = 200 ,
305- matchers = [ auth_matcher (), request_id_matcher ()] ,
288+ headers = api_headers () ,
306289 )
307290
308291 project = todoist_api .unarchive_project (project_id )
@@ -330,7 +313,7 @@ async def test_delete_project(
330313 method = "DELETE" ,
331314 url = endpoint ,
332315 status = 204 ,
333- matchers = [ auth_matcher (), request_id_matcher ()] ,
316+ headers = api_headers () ,
334317 )
335318
336319 response = todoist_api .delete_project (project_id )
@@ -364,10 +347,7 @@ async def test_get_collaborators(
364347 json = page ,
365348 status = 200 ,
366349 params = {"cursor" : cursor } if cursor else {},
367- matchers = [
368- auth_matcher (),
369- request_id_matcher (),
370- ],
350+ headers = api_headers (),
371351 )
372352 cursor = page ["next_cursor" ]
373353
0 commit comments