MCPcopy Create free account
hub / github.com/astercloud/aster / TestCustomProviderValidation

Function TestCustomProviderValidation

pkg/provider/openai_compatible_test.go:291–315  ·  view source on GitHub ↗

TestCustomProviderValidation 测试自定义 Provider 参数验证

(t *testing.T)

Source from the content-addressed store, hash-verified

289
290// TestCustomProviderValidation 测试自定义 Provider 参数验证
291func TestCustomProviderValidation(t *testing.T) {
292 // 缺少 BaseURL
293 config := &types.ModelConfig{
294 Provider: "custom",
295 Model: "gpt-4o",
296 APIKey: "test-key",
297 }
298
299 _, err := NewCustomProvider(config)
300 if err == nil {
301 t.Error("Expected error when BaseURL is missing")
302 }
303
304 // 缺少 APIKey
305 config = &types.ModelConfig{
306 Provider: "custom",
307 Model: "gpt-4o",
308 BaseURL: "https://api.example.com/v1",
309 }
310
311 _, err = NewCustomProvider(config)
312 if err == nil {
313 t.Error("Expected error when APIKey is missing")
314 }
315}
316
317// TestProviderFactory 测试工厂模式
318func TestProviderFactory(t *testing.T) {

Callers

nothing calls this directly

Calls 2

NewCustomProviderFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected