MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / test_validation

Method test_validation

inference/test/test_validation.py:13–43  ·  view source on GitHub ↗
(self, test_data)

Source from the content-addressed store, hash-verified

11 @pytest.mark.asyncio
12 @pytest.mark.test_id("inference_016-017")
13 async def test_validation(self, test_data):
14 model_schema_id = test_data["model_schema_id"]
15 print("model_schema_id: ", model_schema_id)
16 model_type = test_data["model_type"]
17
18 credentials = {
19 key: provider_credentials.aes_decrypt(test_data["credentials"][key])
20 for key in test_data["credentials"].keys()
21 }
22
23 request_data = {"model_schema_id": model_schema_id, "model_type": model_type, "credentials": credentials}
24 if "custom_host" in model_schema_id:
25 request_data.update(
26 {
27 "model_schema_id": "custom_host/openai-text-embedding",
28 "model_type": "text_embedding",
29 "credentials": {
30 "CUSTOM_HOST_ENDPOINT_URL": "https://api.openai.com/v1/embeddings",
31 "CUSTOM_HOST_MODEL_ID": "text-embedding-3-small",
32 "CUSTOM_HOST_API_KEY": Config.CUSTOM_HOST_API_KEY,
33 },
34 "properties": {"embedding_size": 1536},
35 }
36 )
37 try:
38 res = await asyncio.wait_for(verify_credentials(request_data), timeout=120)
39 except asyncio.TimeoutError:
40 pytest.skip("Skipping test due to timeout after 2 minutes.")
41 assert res.status_code == 200, f"test_validation failed: result={res.json()}"
42 assert res.json()["status"] == "success", f"test_validation failed: result={res.json()}"
43 await asyncio.sleep(1)
44
45 @pytest.mark.parametrize(
46 "test_data", generate_wildcard_test_case_for_validation(), ids=lambda d: d["model_schema_id"]

Callers

nothing calls this directly

Calls 3

verify_credentialsFunction · 0.90
updateMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected