b1394a2817
CI / docker (push) Successful in 3m49s
Text keys use OpenAI routes; image keys use predictions with ingress Model ID, OpenAPI input schemas, owner/name or short name resolution, protocol-aware admin whitelist, and in-app API docs aligned to UI conventions. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
913 B
Go
33 lines
913 B
Go
package model
|
|
|
|
import "testing"
|
|
|
|
func TestSplitIngressOwnerName(t *testing.T) {
|
|
owner, name := SplitIngressOwnerName("luminary/flux-sdxl", "comfy-local")
|
|
if owner != "luminary" || name != "flux-sdxl" {
|
|
t.Fatalf("got %q/%q", owner, name)
|
|
}
|
|
owner, name = SplitIngressOwnerName("plain-model", "comfy-local")
|
|
if owner != "comfy-local" || name != "plain-model" {
|
|
t.Fatalf("got %q/%q", owner, name)
|
|
}
|
|
}
|
|
|
|
func TestMatchesIngressRef(t *testing.T) {
|
|
entry := ModelEntry{
|
|
Enabled: true,
|
|
Alias: "luminary/flux-txt2img",
|
|
ModelID: "internal-flux",
|
|
}
|
|
provider := "comfy-ui"
|
|
if !entry.MatchesIngressRef("luminary/flux-txt2img", provider) {
|
|
t.Fatal("expected ingress id / owner/name match")
|
|
}
|
|
if !entry.MatchesIngressRef("flux-txt2img", provider) {
|
|
t.Fatal("expected short name match")
|
|
}
|
|
if entry.MatchesIngressRef("other/flux-txt2img", provider) {
|
|
t.Fatal("unexpected owner mismatch match")
|
|
}
|
|
}
|