33from typing import TYPE_CHECKING , Any
44
55import pytest
6- import responses
76
87from tests .data .test_defaults import DEFAULT_API_URL , PaginatedResults
98from tests .utils .test_utils import (
1514)
1615
1716if TYPE_CHECKING :
17+ from tests .utils .http_mock import RequestsMock
1818 from todoist_api_python .api import TodoistAPI
1919 from todoist_api_python .api_async import TodoistAPIAsync
2020from todoist_api_python .models import Label
2424async def test_get_label (
2525 todoist_api : TodoistAPI ,
2626 todoist_api_async : TodoistAPIAsync ,
27- requests_mock : responses . RequestsMock ,
27+ requests_mock : RequestsMock ,
2828 default_label_response : dict [str , Any ],
2929 default_label : Label ,
3030) -> None :
3131 label_id = "6X7rM8997g3RQmvh"
3232 endpoint = f"{ DEFAULT_API_URL } /labels/{ label_id } "
3333
3434 requests_mock .add (
35- method = responses . GET ,
35+ method = " GET" ,
3636 url = endpoint ,
3737 json = default_label_response ,
3838 status = 200 ,
@@ -54,7 +54,7 @@ async def test_get_label(
5454async def test_get_labels (
5555 todoist_api : TodoistAPI ,
5656 todoist_api_async : TodoistAPIAsync ,
57- requests_mock : responses . RequestsMock ,
57+ requests_mock : RequestsMock ,
5858 default_labels_response : list [PaginatedResults ],
5959 default_labels_list : list [list [Label ]],
6060) -> None :
@@ -63,7 +63,7 @@ async def test_get_labels(
6363 cursor : str | None = None
6464 for page in default_labels_response :
6565 requests_mock .add (
66- method = responses . GET ,
66+ method = " GET" ,
6767 url = endpoint ,
6868 json = page ,
6969 status = 200 ,
@@ -92,7 +92,7 @@ async def test_get_labels(
9292async def test_search_labels (
9393 todoist_api : TodoistAPI ,
9494 todoist_api_async : TodoistAPIAsync ,
95- requests_mock : responses . RequestsMock ,
95+ requests_mock : RequestsMock ,
9696 default_labels_response : list [PaginatedResults ],
9797 default_labels_list : list [list [Label ]],
9898) -> None :
@@ -102,7 +102,7 @@ async def test_search_labels(
102102 cursor : str | None = None
103103 for page in default_labels_response :
104104 requests_mock .add (
105- method = responses . GET ,
105+ method = " GET" ,
106106 url = endpoint ,
107107 json = page ,
108108 status = 200 ,
@@ -135,14 +135,14 @@ async def test_search_labels(
135135async def test_add_label_minimal (
136136 todoist_api : TodoistAPI ,
137137 todoist_api_async : TodoistAPIAsync ,
138- requests_mock : responses . RequestsMock ,
138+ requests_mock : RequestsMock ,
139139 default_label_response : dict [str , Any ],
140140 default_label : Label ,
141141) -> None :
142142 label_name = "A Label"
143143
144144 requests_mock .add (
145- method = responses . POST ,
145+ method = " POST" ,
146146 url = f"{ DEFAULT_API_URL } /labels" ,
147147 json = default_label_response ,
148148 status = 200 ,
@@ -168,7 +168,7 @@ async def test_add_label_minimal(
168168async def test_add_label_full (
169169 todoist_api : TodoistAPI ,
170170 todoist_api_async : TodoistAPIAsync ,
171- requests_mock : responses . RequestsMock ,
171+ requests_mock : RequestsMock ,
172172 default_label_response : dict [str , Any ],
173173 default_label : Label ,
174174) -> None :
@@ -180,7 +180,7 @@ async def test_add_label_full(
180180 }
181181
182182 requests_mock .add (
183- method = responses . POST ,
183+ method = " POST" ,
184184 url = f"{ DEFAULT_API_URL } /labels" ,
185185 json = default_label_response ,
186186 status = 200 ,
@@ -206,7 +206,7 @@ async def test_add_label_full(
206206async def test_update_label (
207207 todoist_api : TodoistAPI ,
208208 todoist_api_async : TodoistAPIAsync ,
209- requests_mock : responses . RequestsMock ,
209+ requests_mock : RequestsMock ,
210210 default_label : Label ,
211211) -> None :
212212 args : dict [str , Any ] = {
@@ -215,7 +215,7 @@ async def test_update_label(
215215 updated_label_dict = default_label .to_dict () | args
216216
217217 requests_mock .add (
218- method = responses . POST ,
218+ method = " POST" ,
219219 url = f"{ DEFAULT_API_URL } /labels/{ default_label .id } " ,
220220 json = updated_label_dict ,
221221 status = 200 ,
@@ -237,13 +237,13 @@ async def test_update_label(
237237async def test_delete_label (
238238 todoist_api : TodoistAPI ,
239239 todoist_api_async : TodoistAPIAsync ,
240- requests_mock : responses . RequestsMock ,
240+ requests_mock : RequestsMock ,
241241) -> None :
242242 label_id = "6X7rM8997g3RQmvh"
243243 endpoint = f"{ DEFAULT_API_URL } /labels/{ label_id } "
244244
245245 requests_mock .add (
246- method = responses . DELETE ,
246+ method = " DELETE" ,
247247 url = endpoint ,
248248 status = 204 ,
249249 )
0 commit comments