Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/test_api_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,35 @@ async def test_get_collaborators(
assert len(respx_mock.calls) == count + 1
assert collaborators == default_collaborators_list[i]
count += 1


@pytest.mark.asyncio
async def test_get_collaborators_accepts_hidden_email(
todoist_api: TodoistAPI,
todoist_api_async: TodoistAPIAsync,
respx_mock: respx.MockRouter,
) -> None:
project_id = "6X7rM8997g3RQmvh"
endpoint = f"{DEFAULT_API_URL}/projects/{project_id}/collaborators"
response: PaginatedResults = {
"results": [{"id": "123", "name": "Alice D.", "email": None}],
"next_cursor": None,
}

mock_route(
respx_mock,
method="GET",
url=endpoint,
request_headers=api_headers(),
response_json=response,
response_status=200,
)

collaborators = next(todoist_api.get_collaborators(project_id))

assert collaborators == [Collaborator(id="123", name="Alice D.", email=None)]

collaborators_async_iter = await todoist_api_async.get_collaborators(project_id)

async for collaborators in collaborators_async_iter:
assert collaborators == [Collaborator(id="123", name="Alice D.", email=None)]
2 changes: 1 addition & 1 deletion todoist_api_python/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class _(JSONPyWizard.Meta): # noqa:N801
v1 = True

id: str
email: str
email: str | None
name: str


Expand Down
Loading