Skip to content

Commit a4ad09e

Browse files
added input validation testing
1 parent 4b0777a commit a4ad09e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

tests/test_api_tasks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,12 @@ async def test_move_task(
467467
assert len(requests_mock.calls) == 3
468468
assert response is True
469469

470+
with pytest.raises(
471+
ValueError,
472+
match="Either `project_id`, `section_id`, or `parent_id` must be provided.",
473+
):
474+
response = await todoist_api_async.move_task(task_id)
475+
470476

471477
@pytest.mark.asyncio
472478
async def test_delete_task(

todoist_api_python/api.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,9 @@ def move_task(
496496
:return: True if the task was moved successfully,
497497
False otherwise (possibly raise `HTTPError` instead).
498498
:raises requests.exceptions.HTTPError: If the API request fails.
499-
:raises ValueError: When `task_id` is not provided.
500499
:raises ValueError: If neither `project_id`, `section_id`,
501500
nor `parent_id` is provided.
502501
"""
503-
if task_id is None:
504-
raise ValueError("`task_id` must be provided.")
505-
506502
if project_id is None and section_id is None and parent_id is None:
507503
raise ValueError(
508504
"Either `project_id`, `section_id`, or `parent_id` must be provided."

todoist_api_python/api_async.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ async def move_task(
365365
:return: True if the task was moved successfully,
366366
False otherwise (possibly raise `HTTPError` instead).
367367
:raises requests.exceptions.HTTPError: If the API request fails.
368-
:raises ValueError: When `task_id` is not provided.
369368
:raises ValueError: If neither `project_id`, `section_id`,
370369
nor `parent_id` is provided.
371370
"""

0 commit comments

Comments
 (0)