Tests¶
The test suite for caldav-tasks-api ensures the reliability and
correctness of its core functionalities. Tests are implemented using
pytest and interact with a live CalDAV server, requiring specific
environment variables for credentials and server details.
The table below provides a summary of the features covered by the automated tests. A ✅ indicates that the feature is covered by one or more tests.
Test Coverage Summary¶
Area |
Feature Tested |
Test Function(s) |
Status |
|---|---|---|---|
TasksAPI |
Fetching & populating task lists |
|
✅ |
TasksAPI |
Finding tasks in lists |
|
✅ |
TasksAPI |
Create and delete task |
|
✅ |
TasksAPI |
Create single task |
|
✅ |
TasksAPI |
Create and rename/update task |
|
✅ |
TasksAPI |
|
|
✅ |
CLI |
|
|
✅ |
CLI |
|
|
✅ |
TasksAPI |
Add task attempt fails (read-only mode) |
|
✅ |
TasksAPI |
Delete task attempt fails (read-only mode) |
|
✅ |
TasksAPI |
Update task attempt fails (read-only mode) |
|
✅ |
TasksAPI |
Create, update X-property, delete task |
|
✅ |
TasksAPI |
|
|
✅ |
TasksAPI |
Parent-child task relationships |
|
✅ |
Setup and Fixtures¶
Tests rely on several pytest fixtures defined in tests/conftest.py:
caldav_credentials: Provides CalDAV server URL, username, and password from environment variables.tasks_api_instance: Provides an initializedTasksAPIinstance connected to the server with data pre-loaded.read_only_tasks_api_instance: Provides an initializedTasksAPIinstance in read-only mode, also with data pre-loaded.test_list_name: Provides the name of a specific CalDAV task list designated for tests involving task creation, modification, and deletion.
Running Tests¶
To run the tests, ensure you have the necessary environment variables set
(see tests/conftest.py for details) and execute pytest from the root of
the project directory.
pytest