Test degraded media capability routing
This commit is contained in:
@@ -31,6 +31,32 @@ func TestMultimodalTranscriptionHandlerReturnsLocalResult(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMultimodalImageGenerationFailsClosedWhenSkillIsUnbound(t *testing.T) {
|
||||||
|
server := multimodalGateway{now: time.Now}
|
||||||
|
body := &bytes.Buffer{}
|
||||||
|
writer := multipart.NewWriter(body)
|
||||||
|
if err := writer.WriteField("prompt", "green bird"); err != nil || writer.Close() != nil {
|
||||||
|
t.Fatal("failed to build generation request")
|
||||||
|
}
|
||||||
|
request := httptest.NewRequest(http.MethodPost, "/v1/multimodal/generate-image", body)
|
||||||
|
request.Header.Set("Content-Type", writer.FormDataContentType())
|
||||||
|
response := httptest.NewRecorder()
|
||||||
|
server.handler(capability.MultimodalGenerateImage)(response, request)
|
||||||
|
if response.Code != http.StatusBadGateway || !bytes.Contains(response.Body.Bytes(), []byte("unavailable")) {
|
||||||
|
t.Fatalf("status=%d body=%s", response.Code, response.Body.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMultimodalVideoUnderstandingFailsClosedWhenSkillIsUnbound(t *testing.T) {
|
||||||
|
server := multimodalGateway{now: time.Now}
|
||||||
|
request := multipartRequest(t, "/v1/multimodal/video-understand", "clip.mp4", []byte("video"))
|
||||||
|
response := httptest.NewRecorder()
|
||||||
|
server.handler(capability.MultimodalUnderstandVideo)(response, request)
|
||||||
|
if response.Code != http.StatusBadGateway || !bytes.Contains(response.Body.Bytes(), []byte("unavailable")) {
|
||||||
|
t.Fatalf("status=%d body=%s", response.Code, response.Body.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func multipartRequest(t *testing.T, path, filename string, data []byte) *http.Request {
|
func multipartRequest(t *testing.T, path, filename string, data []byte) *http.Request {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
body := &bytes.Buffer{}
|
body := &bytes.Buffer{}
|
||||||
|
|||||||
Reference in New Issue
Block a user