Complete batch import v2 runtime and host capability recovery
This commit is contained in:
@@ -979,6 +979,41 @@ func TestCheckGatewayCompletionWithMock(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisableOpenAIResponsesAPIWithMock(t *testing.T) {
|
||||
var calls []string
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
calls = append(calls, r.Method+" "+r.URL.Path)
|
||||
if r.Method != http.MethodPut {
|
||||
t.Fatalf("method = %q, want PUT", r.Method)
|
||||
}
|
||||
var payload struct {
|
||||
Extra map[string]any `json:"extra"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil {
|
||||
t.Fatalf("decode request: %v", err)
|
||||
}
|
||||
if got, ok := payload.Extra["openai_responses_supported"].(bool); !ok || got {
|
||||
t.Fatalf("openai_responses_supported = %+v, want false", payload.Extra["openai_responses_supported"])
|
||||
}
|
||||
w.Write([]byte(`{"data":{"id":1}}`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
client, _ := NewClient(srv.URL, WithAPIKey("k"))
|
||||
if err := client.DisableOpenAIResponsesAPI(context.Background(), []string{"101", "101", " ", "102"}); err != nil {
|
||||
t.Fatalf("DisableOpenAIResponsesAPI() error = %v", err)
|
||||
}
|
||||
if len(calls) != 2 {
|
||||
t.Fatalf("calls = %v, want 2 unique account updates", calls)
|
||||
}
|
||||
if calls[0] != "PUT /api/v1/admin/accounts/101" {
|
||||
t.Fatalf("first call = %q, want PUT /api/v1/admin/accounts/101", calls[0])
|
||||
}
|
||||
if calls[1] != "PUT /api/v1/admin/accounts/102" {
|
||||
t.Fatalf("second call = %q, want PUT /api/v1/admin/accounts/102", calls[1])
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchCreateAccountsWithMock(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
|
||||
Reference in New Issue
Block a user