- Refactored all nodes to accept both manual string input and connected models_json - Removed rigid enum-based dropdowns in favor of flexible STRING inputs - Added optional models_json input to Select, Load, and Unload nodes - Nodes now parse JSON and update cache when models_json is connected - Supports Ollama's auto-pull behavior for models not yet downloaded - Updated category from "Ollama/Enum" to "Ollama" for cleaner UI organization Benefits: - No UI refresh required for manual model entry - Automatic model pulling when typing new model names - Still supports connected workflow pattern (Refresh → Select → Load) - Maximum flexibility - users choose their preferred workflow Test updates: - Fixed all tests for new flexible input signatures - Added comprehensive warning filters for pytest mock internals - All 28 tests passing with 0 warnings Documentation: - Updated README with both usage patterns (connected and manual) - Added example workflows for different use cases - Clarified benefits of each approach
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
"""Tests for logging configuration."""
|
|
|
|
from comfyui_ollama_model_manager.log_config import (
|
|
get_logger,
|
|
scrub_secrets,
|
|
set_request_id,
|
|
)
|
|
|
|
|
|
def test_get_logger():
|
|
"""Test getting a logger instance."""
|
|
logger = get_logger()
|
|
assert logger is not None
|
|
assert hasattr(logger, "info")
|
|
assert hasattr(logger, "error")
|
|
assert hasattr(logger, "debug")
|
|
|
|
|
|
def test_set_request_id():
|
|
"""Test setting correlation ID."""
|
|
test_id = "test-123"
|
|
set_request_id(test_id)
|
|
# If this doesn't raise, it works
|
|
assert True
|
|
|
|
|
|
def test_scrub_secrets():
|
|
"""Test secret scrubbing from log messages."""
|
|
# Test with Bearer token
|
|
text = "Authorization: Bearer abc123def456ghi789jkl012mno345pqr678stu901"
|
|
scrubbed = scrub_secrets(text)
|
|
assert "Bearer <redacted>" in scrubbed
|
|
assert "abc123def456ghi789jkl012mno345pqr678stu901" not in scrubbed
|
|
|
|
# Test with no secrets
|
|
text = "This is a normal log message"
|
|
scrubbed = scrub_secrets(text)
|
|
assert scrubbed == text
|
|
|
|
|
|
def test_logger_can_log_messages():
|
|
"""Test that logger can actually log messages without errors."""
|
|
logger = get_logger()
|
|
|
|
# These should not raise exceptions
|
|
logger.info("Test info message")
|
|
logger.debug("Test debug message")
|
|
logger.warning("Test warning message")
|
|
|
|
# Test with structured data
|
|
logger.info("Test with data", extra={"key": "value"})
|