76ba500417
CI / docker (push) Successful in 2m4s
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress, ingress key governance, monitoring, and security controls. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
637 B
Go
26 lines
637 B
Go
package gateway
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/rose_cat707/luminary/internal/provider"
|
|
)
|
|
|
|
func TestExtractAPIErrorMessage_OpenAI(t *testing.T) {
|
|
body := []byte(`{"error":{"message":"Invalid API key","type":"invalid_request_error"}}`)
|
|
got := extractAPIErrorMessage(body)
|
|
if got != "invalid_request_error: Invalid API key" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestDescribeForwardError_WithBody(t *testing.T) {
|
|
got := describeForwardError(nil, &provider.ChatResponse{
|
|
StatusCode: 400,
|
|
Body: []byte(`{"error":{"message":"model not found"}}`),
|
|
})
|
|
if got != "status 400: model not found" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
}
|