Files
Luminary/internal/gateway/logbody_test.go
T
renjue 76ba500417
CI / docker (push) Successful in 2m4s
Initial commit: Luminary AI Gateway
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>
2026-06-23 21:46:16 +08:00

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)
}
}