fix(tests): 修復測試 lint 錯誤 + TelegramGateway 方法呼叫

修復項目:
1. 新增 conftest.py 確保環境變數在 settings 前載入
2. test_github_webhook.py 移除重複的 os.environ 設定 (E402)
3. test_smart_router.py 排序 import (I001)
4. github_webhook.py 修正 send_message → send_notification

Phase 13.1 首席架構師審查修復

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-26 10:37:45 +08:00
parent a22ee766da
commit 648e100e3c
4 changed files with 36 additions and 16 deletions

View File

@@ -14,13 +14,6 @@ Phase 13.1: GitHub Webhook 整合測試
import hashlib
import hmac
import json
import os
# 設定測試環境變數 (在 import main 之前)
os.environ.setdefault("MOCK_MODE", "true")
os.environ.setdefault("ENVIRONMENT", "dev")
os.environ.setdefault("GITHUB_WEBHOOK_SECRET", "test-secret-key-12345")
os.environ.setdefault("GITHUB_ALLOWED_REPOS", "test-owner/test-repo,wooo-ai/awoooi")
import httpx
import pytest
@@ -28,6 +21,8 @@ from httpx import ASGITransport
from src.main import app
# 環境變數設定已移至 conftest.py (解決 E402)
# =============================================================================
# Test Fixtures