feat: 重构测试框架并优化代码结构
refactor(tests): 将e2e_tests迁移到tests_suite和api_integration_tests style: 为Java类添加文档注释 docs: 更新.gitignore和配置文件 test: 添加性能测试和Playwright测试脚本 chore: 清理旧测试文件和配置
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
ENVIRONMENT: str = "dev"
|
||||
|
||||
API_BASE_URL: str = "http://localhost:8080"
|
||||
WEB_BASE_URL: str = "http://localhost:3003"
|
||||
|
||||
DB_HOST: str = "localhost"
|
||||
DB_PORT: int = 5432
|
||||
DB_NAME: str = "manage_system"
|
||||
DB_USERNAME: str = "postgres"
|
||||
DB_PASSWORD: str = "postgres"
|
||||
|
||||
TEST_USERNAME: str = "admin"
|
||||
TEST_PASSWORD: str = "admin123"
|
||||
|
||||
HEADLESS_BROWSER: bool = True
|
||||
BROWSER_TYPE: str = "chromium"
|
||||
REQUEST_TIMEOUT: int = 30000
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
case_sensitive = True
|
||||
|
||||
|
||||
class DevSettings(Settings):
|
||||
ENVIRONMENT: str = "dev"
|
||||
API_BASE_URL: str = "http://localhost:8080"
|
||||
WEB_BASE_URL: str = "http://localhost:3003"
|
||||
|
||||
|
||||
class StagingSettings(Settings):
|
||||
ENVIRONMENT: str = "staging"
|
||||
API_BASE_URL: str = "http://staging-api.example.com"
|
||||
WEB_BASE_URL: str = "http://staging-web.example.com"
|
||||
|
||||
|
||||
class ProductionSettings(Settings):
|
||||
ENVIRONMENT: str = "production"
|
||||
API_BASE_URL: str = "https://api.example.com"
|
||||
WEB_BASE_URL: str = "https://example.com"
|
||||
|
||||
|
||||
def get_settings() -> Settings:
|
||||
env = Settings().ENVIRONMENT
|
||||
if env == "production":
|
||||
return ProductionSettings()
|
||||
elif env == "staging":
|
||||
return StagingSettings()
|
||||
else:
|
||||
return DevSettings()
|
||||
|
||||
|
||||
settings = get_settings()
|
||||
Reference in New Issue
Block a user