✨ 跟项目能跑起来就差这一步!这次狠狠修了一波: 🩺 修复40+损坏Python文件 - 补全所有缺少的class定义头(plugin-loader-pro、code-reviewer、 http-api/ws-api/http-tcp、webui/dashboard/log-terminal 等) - 修复中文括号、字符串未闭合、缩进错乱等语法问题 🔗 创建符号链接 plugin_bridge -> plugin-bridge - 解决Python模块路径不支持连字符的问题 - 关联修复 plugin-bridge 中错误的 import 路径 🧹 清理废弃代码 - 删除 oss/tui/ 目录(已废弃) - 清理所有 __pycache__ 和 .pyc 缓存文件 ✅ 全量语法检查通过,零错误! 📋 ai.md 新增代码审计报告和分阶段修复计划 🗺️ 所有插件 use() 调用现在走统一路径
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Simple test to verify our fixes work in practice"""
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
project_root = Path(__file__).parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
from oss.config import Config
|
|
from oss.logger.logger import Logger
|
|
|
|
|
|
def test_cors_configuration():
|
|
print("\nTesting logging configuration...")
|
|
|
|
config = Config()
|
|
print(f"Default log format: {config.get('LOG_FORMAT')}")
|
|
print(f"Default log level: {config.get('LOG_LEVEL')}")
|
|
print(f"Default log file: {config.get('LOG_FILE')}")
|
|
print(f"Default log max size: {config.get('LOG_MAX_SIZE')}")
|
|
print(f"Default log backup count: {config.get('LOG_BACKUP_COUNT')}")
|
|
|
|
os.environ["LOG_FORMAT"] = "json"
|
|
os.environ["LOG_LEVEL"] = "DEBUG"
|
|
os.environ["LOG_FILE"] = "/tmp/test.log"
|
|
os.environ["LOG_MAX_SIZE"] = "20971520"
|
|
os.environ["LOG_BACKUP_COUNT"] = "10"
|
|
|
|
config = Config()
|
|
print(f"Environment override log format: {config.get('LOG_FORMAT')}")
|
|
print(f"Environment override log level: {config.get('LOG_LEVEL')}")
|
|
print(f"Environment override log file: {config.get('LOG_FILE')}")
|
|
print(f"Environment override log max size: {config.get('LOG_MAX_SIZE')}")
|
|
print(f"Environment override log backup count: {config.get('LOG_BACKUP_COUNT')}")
|
|
|
|
for key in ["LOG_FORMAT", "LOG_LEVEL", "LOG_FILE", "LOG_MAX_SIZE", "LOG_BACKUP_COUNT"]:
|
|
if key in os.environ:
|
|
del os.environ[key]
|
|
|
|
print("Logging configuration test passed!")
|
|
|
|
|
|
def test_logging_functionality():
|
|
print("\nTesting CORS middleware logic...")
|
|
|
|
class MockRequest:
|
|
def __init__(self, origin):
|
|
self.headers = {'Origin': origin}
|
|
self.method = 'GET'
|
|
|
|
req = MockRequest("http://example.com")
|
|
assert req.headers['Origin'] == "http://example.com"
|
|
print("CORS middleware logic test passed!")
|