This directory contains comprehensive test cases for the Plane Python SDK.
The test suite is organized into two main categories:
Pytest-based unit tests that make real HTTP requests (no mocking) and function as smoke tests. These tests verify that all API endpoints are accessible and return expected data structures.
Test Files:
test_users.py- Users API (get_me, list, retrieve)test_workspaces.py- Workspaces API (get_members)test_projects.py- Projects API (CRUD operations)test_labels.py- Labels API (CRUD operations)test_states.py- States API (CRUD operations)test_epics.py- Epics API (list, retrieve)test_work_items.py- WorkItems API (CRUD + sub-resources: comments, links, activities, attachments)test_modules.py- Modules API (CRUD operations)test_cycles.py- Cycles API (CRUD operations)test_pages.py- Pages API (project/workspace page creation)test_intake.py- Intake API (CRUD operations)test_work_item_types.py- WorkItemTypes API (CRUD operations)test_work_item_properties.py- WorkItemProperties API (CRUD operations)test_customers.py- Customers API (CRUD operations)
Shared Fixtures (conftest.py):
client- Initialized Plane client with authenticationbase_url- Base URL from environment (PLANE_BASE_URL)api_key/access_token- Authentication credentials (PLANE_API_KEY / PLANE_ACCESS_TOKEN)workspace_slug- Workspace identifier (WORKSPACE_SLUG)
Comprehensive integration tests and example scripts demonstrating complex workflows.
Test Files:
test_comprehensive.py- End-to-end tests covering project creation, work items, properties, and cyclestest_modules.py- Tests for module functionality including creation, updates, archiving, and work item managementtest_property_values.py- Tests for property value operations including create, update, retrieve, and deletetest_advanced_properties.py- Advanced property configuration and usage teststest_work_item_types_and_properties.py- Combined tests for work item types and their properties- Additional resource-specific test scripts
See tests/scripts/TEST_SCRIPT_USAGE.md for detailed usage instructions for script tests.
Set the following environment variables:
export PLANE_BASE_URL="http://127.0.0.1:8000" # or https://api.plane.so
export PLANE_API_KEY="your_api_key" # or PLANE_ACCESS_TOKEN
export WORKSPACE_SLUG="your_workspace"# Run all unit and script tests
pytest tests/
# Run only unit tests
pytest tests/unit/
# Run only script tests
pytest tests/scripts/# Unit tests
pytest tests/unit/test_projects.py
pytest tests/unit/test_work_items.py
pytest tests/unit/test_modules.py
# Script tests
pytest tests/scripts/test_comprehensive.py
pytest tests/scripts/test_modules.py
pytest tests/scripts/test_property_values.py# Unit test classes
pytest tests/unit/test_projects.py::TestProjectsAPICRUD
pytest tests/unit/test_work_items.py::TestWorkItemsAPICRUD
# Script test classes
pytest tests/scripts/test_comprehensive.py::TestComprehensiveWorkflow
pytest tests/scripts/test_modules.py::TestModuleFunctionality
pytest tests/scripts/test_property_values.py::TestPropertyValueOperationspytest tests/unit/test_projects.py::TestProjectsAPICRUD::test_create_project
pytest tests/scripts/test_comprehensive.py::TestComprehensiveWorkflow::test_create_project_with_all_featurespytest tests/ -vpytest tests/ --cov=plane --cov-report=html- No Mocking: All tests make real HTTP requests to verify API connectivity
- Smoke Test Focus: Basic functionality verification (endpoints respond, data structures are correct)
- Automatic Cleanup: Resources created during tests are automatically cleaned up via pytest fixtures
- Environment-Aware: Tests automatically skip if required environment variables are not set
- Fast Execution: Lightweight tests focused on API endpoint accessibility
- Comprehensive Coverage: End-to-end workflows and complex scenarios
- Real API Interactions: Full integration with Plane API
- Detailed Examples: Serve as both tests and usage examples
- Resource Management: Manual or automatic cleanup depending on test complexity
All tests automatically clean up resources they create:
- Unit Tests: Resources are cleaned up automatically via pytest fixtures using
yieldstatements - Script Tests: Cleanup behavior varies by test file; most include cleanup logic
- Projects, work items, labels, states, and other resources are deleted after tests complete
- If cleanup fails (e.g., due to permissions), a warning may be printed but tests continue
These tests require:
- A running Plane instance (local or hosted)
- Valid API credentials (PLANE_API_KEY or PLANE_ACCESS_TOKEN)
- Appropriate workspace permissions
- Network access to the Plane API endpoint
Most tests will skip automatically if required environment variables are not set, making them safe to run in CI/CD pipelines.
- Keep tests focused on single API operations
- Use fixtures for shared setup and teardown
- Avoid creating unnecessary resources
- Test both success and expected error cases
- Document complex workflows clearly
- Include cleanup in test scripts
- Provide meaningful assertions and output
- Use as reference implementations for SDK usage