mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-08 21:54:26 +08:00
2.5 KiB
2.5 KiB
ComfyUI-Manager API Tests
This directory contains tests for the ComfyUI-Manager API endpoints, validating the OpenAPI specification and ensuring API functionality.
Setup
- Install test dependencies:
pip install -r requirements-test.txt
- Ensure ComfyUI is running with ComfyUI-Manager installed:
# Start ComfyUI with the default server
python main.py
Running Tests
Run all tests
pytest -xvs
Run specific test files
# Run only the spec validation tests
pytest -xvs test_spec_validation.py
# Run only the custom node API tests
pytest -xvs test_customnode_api.py
Run specific test functions
# Run a specific test
pytest -xvs test_customnode_api.py::test_get_custom_node_list
Test Configuration
The tests use the following default configuration:
- Server URL:
http://localhost:8188 - Server timeout: 2 seconds
- Wait between requests: 0.5 seconds
- Maximum retries: 3
You can override these settings with environment variables:
# Use a different server URL
COMFYUI_SERVER_URL=http://localhost:8189 pytest -xvs
Test Categories
The tests are organized into the following categories:
- Spec Validation (
test_spec_validation.py): Validates that the OpenAPI specification is correct and complete. - Custom Node API (
test_customnode_api.py): Tests for custom node management endpoints. - Snapshot API (
test_snapshot_api.py): Tests for snapshot management endpoints. - Queue API (
test_queue_api.py): Tests for queue management endpoints. - Config API (
test_config_api.py): Tests for configuration endpoints. - Model API (
test_model_api.py): Tests for model management endpoints (minimal as these are being deprecated).
Test Implementation Details
Fixtures
test_config: Provides the test configurationserver_url: Returns the server URL from the configurationopenapi_spec: Loads the OpenAPI specificationapi_client: Creates a requests Session for API callsapi_request: Helper function for making consistent API requests
Utilities
validation.py: Functions for validating responses against the OpenAPI schemaschema_utils.py: Utilities for extracting and manipulating schemas
Notes
- Some tests are skipped with
@pytest.mark.skipto avoid modifying state in automated testing - Security-level restricted endpoints have minimal tests to avoid security issues
- Tests focus on read operations rather than write operations where possible