Merge branch 'test_client' into develop

This commit is contained in:
misyaguziya
2025-10-30 22:04:34 +09:00
3 changed files with 8 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
# backend_test.py - APIエンドポイントテストモジュール # test_endpoints.py - APIエンドポイントテストモジュール
## 概要 ## 概要
VRCTアプリケーションのAPIエンドポイントを包括的にテストするためのモジュールです。メインループの各種機能をランダムアクセスでテストし、システムの安定性と堅牢性を検証します。 VRCTアプリケーションのAPIエンドポイントを包括的にテストするためのモジュールです。メインループの各種機能をランダムアクセスでテストし、システムの安定性と堅牢性を検証します。

View File

@@ -540,6 +540,7 @@ class AutomatedEndpointTester:
lst = self._get("/get/data/plamo_model_list") or [] lst = self._get("/get/data/plamo_model_list") or []
import random import random
data = random.choice(lst) if lst else None data = random.choice(lst) if lst else None
expected = [200,400]
elif endpoint == "/set/data/plamo_auth_key": elif endpoint == "/set/data/plamo_auth_key":
data = "PLAMO_DUMMY_KEY" data = "PLAMO_DUMMY_KEY"
expected = [200,400] expected = [200,400]
@@ -547,6 +548,7 @@ class AutomatedEndpointTester:
lst = self._get("/get/data/gemini_model_list") or [] lst = self._get("/get/data/gemini_model_list") or []
import random import random
data = random.choice(lst) if lst else None data = random.choice(lst) if lst else None
expected = [200,400]
elif endpoint == "/set/data/gemini_auth_key": elif endpoint == "/set/data/gemini_auth_key":
data = "GEMINI_DUMMY_KEY" data = "GEMINI_DUMMY_KEY"
expected = [200,400] expected = [200,400]
@@ -554,6 +556,7 @@ class AutomatedEndpointTester:
lst = self._get("/get/data/openai_model_list") or [] lst = self._get("/get/data/openai_model_list") or []
import random import random
data = random.choice(lst) if lst else None data = random.choice(lst) if lst else None
expected = [200,400]
elif endpoint == "/set/data/openai_auth_key": elif endpoint == "/set/data/openai_auth_key":
data = "OPENAI_DUMMY_KEY" data = "OPENAI_DUMMY_KEY"
expected = [200,400] expected = [200,400]
@@ -561,6 +564,7 @@ class AutomatedEndpointTester:
lst = self._get("/get/data/lmstudio_model_list") or [] lst = self._get("/get/data/lmstudio_model_list") or []
import random import random
data = random.choice(lst) if lst else None data = random.choice(lst) if lst else None
expected = [200,400]
elif endpoint == "/set/data/lmstudio_url": elif endpoint == "/set/data/lmstudio_url":
import random import random
data = random.choice(["http://localhost:1234/v1","http://127.0.0.1:1234/v1","http://invalid_host:9999/v1"]) data = random.choice(["http://localhost:1234/v1","http://127.0.0.1:1234/v1","http://invalid_host:9999/v1"])
@@ -569,6 +573,7 @@ class AutomatedEndpointTester:
lst = self._get("/get/data/ollama_model_list") or [] lst = self._get("/get/data/ollama_model_list") or []
import random import random
data = random.choice(lst) if lst else None data = random.choice(lst) if lst else None
expected = [200,400]
elif endpoint == "/set/data/deepl_auth_key": elif endpoint == "/set/data/deepl_auth_key":
data = "DEEPL_DUMMY_KEY" data = "DEEPL_DUMMY_KEY"
expected=[200,400] expected=[200,400]
@@ -745,7 +750,8 @@ class AutomatedEndpointTester:
self._record(endpoint, None, None, expected) self._record(endpoint, None, None, expected)
print(f"[SetData] {endpoint} -> {Color.RED}UNKNOWN{Color.RESET}") print(f"[SetData] {endpoint} -> {Color.RED}UNKNOWN{Color.RESET}")
return False return False
if data is None: # data が None でも expected に 400 が含まれていれば送信してテスト
if data is None and 400 not in expected:
self._record(endpoint, None, None, expected) self._record(endpoint, None, None, expected)
print(f"[SetData] {endpoint} -> {Color.YELLOW}SKIP(no data){Color.RESET}") print(f"[SetData] {endpoint} -> {Color.YELLOW}SKIP(no data){Color.RESET}")
return True return True